private boolean canRemoveJar(Jar currentJar) { Collection col = otherDeployedServices.values(); boolean found = false; Iterator it = col.iterator(); while (it.hasNext() && !found) { Deployment serviceD = (Deployment)it.next(); if (serviceD.getJars() != null && serviceD.getJars().getJar() != null) { Iterator jarIt = new ArrayIterator(serviceD.getJars().getJar()); while (jarIt.hasNext() && !found) { Jar thisJar = (Jar) jarIt.next(); if (thisJar.getLocation().equals(currentJar.getLocation()) && thisJar.getName().equals(currentJar.getName())) { found = true; break; } } } } return !found; }
private static Iterator getIterator(Object thing) { if (thing instanceof Collection) { return ((Collection) thing).iterator(); } else if (thing instanceof Map) { return ((Map) thing).values().iterator(); } else if (Object[].class.isAssignableFrom(thing.getClass())) { return new ArrayIterator(thing); } else { return die("find: invalid argument type "+thing.getClass().getName()); } }
/** * returns an iterator on all the enumerated instaces. * @return iterator */ public static Iterator<SortOrderEnum> iterator() { return new ArrayIterator(ALL); }
/** * Returns an iterator for elements of an array of <code>values</code>. * * @param <T> * @param values the array to iterate over. * @param from the index to start iterating at. * @param to the index to finish iterating at. * @return */ @SuppressWarnings("unchecked") public static <T> Iterator<T> arrayIterator(T[] values, int from, int to) { return new ArrayIterator(values, from, to); }