List of utility methods to do Collection First
T | first(Collection first return c.iterator().next();
|
T | first(Collection Return the first element of the collection. if (collection.isEmpty()) { return null; return collection.iterator().next(); |
T | first(Collection Replaces first() LINQ Returns first object of collection or null if empty Iterator<T> iterator = collection.iterator(); if (iterator.hasNext()) return iterator.next(); else return null; |
Object | firstElement(Collection in) return the first element in a collection - this is most useful where only one item exists in the collection if (in.size() == 0) throw new IllegalArgumentException("firstElement requies at least one entry"); return (in.iterator().next()); |
T | firstElement(Collection first Element if (c != null && !c.isEmpty()) { return c.iterator().next(); return null; |
T | firstElementOf(final Collection extends T> collection) Returns the first element of the given collection if (isEmpty(collection)) { return null; return collection.iterator().next(); |
T | firstElementOf(final Collection extends T> items) first Element Of if (items != null && !items.isEmpty()) { return items.iterator().next(); return null; |
Object | firstFrom(Collection collection) first From return collection.iterator().next();
|
T | firstFrom(Collection first From if (isEmpty(coll)) return null; return coll.iterator().next(); |
Collection | firstNonEmpty(Collection first Non Empty for (Collection<T> collection : collections) if (!isEmpty(collection)) return collection; return emptySet(); |