List of utility methods to do Iterable Item
void | clear(Iterable> iterable) Remove all elements from the given Iterable. if (iterable instanceof Collection) { ((Collection<?>) iterable).clear(); } else { clear(iterable.iterator()); |
Iterable | concat(final Iterable extends Iterable concat return new Iterable<T>() { @Override public Iterator<T> iterator() { return new Iterator<T>() { private final Iterator<? extends Iterable<T>> iterablesIterator = iterables.iterator(); private Iterator<T> currentIterator = iterablesIterator.hasNext() ? iterablesIterator.next().iterator() : null; ... |
Iterable | concat(Iterable extends T>... iterables) concat return concat(Arrays.asList(iterables));
|
Iterable | concat(Iterable concat return new Iterable<T>() { final Iterator<T> it1 = first.iterator(); final Iterator<T> it2 = second.iterator(); @Override public Iterator<T> iterator() { return new Iterator<T>() { Iterator<T> curr; @Override ... |
boolean | contains(Iterable> iter, Object o) Test whether the given object appears in an iteration of iter . if (iter instanceof Collection<?>) { return ((Collection<?>) iter).contains(o); } else { return iteratedContains(iter, o); |
E | getFirst(final Iterable Retrieves the first element of an Iterable final Iterator<E> iter = iterator(iterable); return hasNext(iter) ? iter.next() : null; |
T | getFirst(Iterable get First final Iterator<T> iterator = iterable.iterator(); if (iterator.hasNext()) { return iterator.next(); } else { throw new NoSuchElementException(); |
Object | getFirstElement(Object maybeIterable) Returns the first element, if any, of an object that may be an Iterable if (!(maybeIterable instanceof Iterable<?>)) return null; Iterable<?> iterable = (Iterable<?>) maybeIterable; Iterator<?> iterator = iterable.iterator(); return iterator.hasNext() ? iterator.next() : null; |
T | getFrom(Iterable get From if (iterable instanceof List<?>) { return (T) ((List<?>) iterable).get(index); return elementAt(iterable, index); |
boolean | isIterable(Object obj) is Iterable return obj.getClass().isArray() || (obj instanceof Class<?> && ((Class<?>) obj).isArray()) || obj instanceof Iterable || obj instanceof Enumeration; |