/** * Obtains an {@link Application} in this group with the given name. If * no such {@link Application} exists in the group, <code>null</code> will * be returned. If multiple {@link Application}s in the group have the * given name, an arbitary {@link Application} of the name will be returned * * @param name the name of the application to get * @return the application in this group with the given name or null * if no application has been realized with the given name */ public A getApplication(String name) { for (A application : applications) { if (application.getName().equals(name)) { return application; } } return null; }
/** * Obtains the {@link Application}s in this group where by their * {@link Application#getName()} starts with the specified prefix. * * @param prefix the prefix of application names to return * @return the application in this group with the given name or null * if no application has been realized with the given name */ public Iterable<A> getApplications(String prefix) { LinkedList<A> list = new LinkedList<A>(); for (A application : applications) { if (application.getName().startsWith(prefix)) { list.add(application); } } return list; }