1
0
mirror of synced 2026-05-22 13:23:17 +00:00

* samples/contacts/src/sample/contact/ContactManagerBackend.java:

Clean up how the contacts are returned.  Do not create unnecessary
  objects.
This commit is contained in:
Francois Beausoleil
2004-03-23 17:25:34 +00:00
parent c3507b26c9
commit 95d7ac1bf3
@@ -25,12 +25,12 @@ import java.util.Vector;
/** /**
* Backend business object that manages the contacts. * Backend business object that manages the contacts.
* *
* <P> * <P>
* As a backend, it never faces the public callers. It is always accessed via * As a backend, it never faces the public callers. It is always accessed via
* the {@link ContactManagerFacade}. * the {@link ContactManagerFacade}.
* </p> * </p>
* *
* <P> * <P>
* This facade approach is not really necessary in this application, and is * This facade approach is not really necessary in this application, and is
* done simply to demonstrate granting additional authorities via the * done simply to demonstrate granting additional authorities via the
@@ -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()]);
} }
} }