List of utility methods to do Collection First
E | firstNonNull(Collection first Non Null return firstNonNull(collection, null);
|
T | firstOrThat(Collection first Or That if (collection == null || collection.size() == 0) { return that; return collection.iterator().next(); |
T | firstValue(Class first Value final T value = findFirstValue(type, values); if (null != value) { return value; throw new IllegalStateException("Expecting at least one value"); |
Object | GET_FIRST_ELEMENT(Collection> coll) Returns the first element of the given collection. Object ret = null; if (coll.size() > 0) { Object[] ar = new Object[coll.size()]; ar = coll.toArray(ar); for (int i = 0; i < ar.length; i++) { if ((ar[i] != null)) { ret = ar[i]; break; ... |
T | getCollectionFirstElement(final Collection Gets the first element of a collection, if it exist. T result = null; if (collection.isEmpty() == false) { result = new ArrayList<T>(collection).get(0); return result; |
Object | getFirst(Collection c) Returns the first element in a collection (according to its iterator). return c.iterator().next();
|
Object | getFirst(Collection> c) get First if (c == null || c.isEmpty()) { return null; return c.iterator().next(); |
String | getFirst(Collection Utility function to get a sample item from a collection Iterator<String> it = collection.iterator(); if (it.hasNext()) { return it.next(); return null; |
T | getFirst(Collection get First if (bag.isEmpty()) return null; if (bag instanceof java.util.List) { return ((List<T>) bag).get(0); } else { return bag.iterator().next(); |
T | getFirst(Collection get First return getFirst(c.iterator());
|