List of utility methods to do Collection Element Get
List | getAll(Map Get all values corresponding to the indices (if they exist in the map). List<V> result = new ArrayList<>(); for (T i : indices) if (map.containsKey(i)) { result.add(map.get(i)); return result; |
Set | getAllDoubleValues( Map This method looks up all the values (for instance years) to display in the, selection box for search parameters when the FNumber box is selected. Set<Double> returnValues = new TreeSet<Double>(); for (String javaPegId : doubleCollectionWithValuesToFetch.keySet()) { returnValues.addAll(doubleCollectionWithValuesToFetch.get(javaPegId).keySet()); return returnValues; |
String | getAllTopicsAsString(final Collection get All Topics As String final StringBuffer messages = new StringBuffer(); for (final String topic : topics) { messages.append(topic); messages.append(System.lineSeparator()); return messages.toString(); |
Set | getAncestors(Collection Returns all the common ancestor classes from the given set of classes. Set<Class<?>> intersection = new LinkedHashSet<Class<?>>(); for (Class<?> klass : classes) { if (intersection.size() == 0) { intersection.addAll(getAncestors(klass)); } else { intersection.retainAll(getAncestors(klass)); return intersection; |
T | getAnElement(Collection Returns an arbitrary element from the collection if (coll == null) { throw new IllegalArgumentException("Called with null collection"); } else if (coll.size() == 0) { return null; if (coll instanceof List) { return ((List<T>) coll).get(0); Iterator<T> it = coll.iterator(); return it.next(); |
T | getAny(final Collection Returns an arbitrary element from the given collection. final Iterator<T> iterator = collection.iterator(); if (iterator.hasNext()) { return iterator.next(); return null; |
T | getAnyFrom(Collection Gets one element from the provided Collection. final Iterator<T> iterator = collection.iterator(); if (iterator.hasNext()) { return iterator.next(); throw new NoSuchElementException("No value present"); |
T | getArbitraryMember(Collection get Arbitrary Member return s.isEmpty() ? null : s.iterator().next();
|
String[] | getArray(Collection dnaCol) get Array return (String[]) dnaCol.toArray(new String[0]); |
String[] | getArrayFromCollection(Collection get Array From Collection int size = collection.size(); Object[] objs = collection.toArray(); String[] result = new String[size]; for (int i = 0; i < size; i++) { result[i] = objs[i].toString(); return result; |