List of utility methods to do Iterable Size
T | singleOrNull(Iterable Method returns the single element from an iterable or null if empty iterable is passed. if (iterable == null) { throw new IllegalArgumentException("Null is not a valid argument for this method"); Iterator<T> iterator = iterable.iterator(); if (!iterable.iterator().hasNext()) { return null; } else { T element = iterator.next(); ... |
int | size(final Iterable> iterable) Returns size of iterable. return (iterable instanceof Collection) ? ((Collection<?>) iterable).size() : size(iterable.iterator()); |
int | size(final Iterable Calculates the number of generated elements of the given iterable. if (iterable != null) { return size(iterable.iterator()); } else { return 0x00; |
int | size(Iterable> it) Count statements in iterable 'it' int count = 0; Iterator<?> i = it.iterator(); while (i.hasNext()) { i.next(); count++; return count; |
int | size(Iterable> iterable) size return (iterable instanceof Collection) ? ((Collection<?>) iterable).size() : size(iterable.iterator()); |
int | size(Iterable> values) Returns the number of elements in the Iterable . if (values instanceof Collection<?>) { return ((Collection<?>) values).size(); int count = 0; for (Iterator<?> it = values.iterator(); it.hasNext(); ++count) { it.next(); return count; ... |
boolean | sizeEquals(Iterable size Equals Iterator<T> iterator = iterable.iterator(); int currentSize = 0; while (iterator.hasNext()) { if (expectedSize > currentSize) { currentSize++; iterator.next(); continue; } else { ... |