* samples/contacts/src/sample/contact/ContactManagerBackend.java:
Clean up how the contacts are returned. Do not create unnecessary objects.
This commit is contained in:
@@ -87,13 +87,10 @@ public class ContactManagerBackend implements ContactManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact[] resultType = {new Contact(new Integer(1), "holder", "holder",
|
|
||||||
"holder")};
|
|
||||||
|
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return (Contact[]) list.toArray(resultType);
|
return (Contact[]) list.toArray(new Contact[list.size()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user