public class IterableHelper
extends java.lang.Object
| Constructor and Description |
|---|
IterableHelper() |
| Modifier and Type | Method and Description |
|---|---|
static <E> int |
count(java.lang.Iterable<E> itr) |
static <E> int |
count(java.util.Iterator<E> itr)
This will consume the iterator, so use it with caution!
|
static <E> int |
countOccurances(E occurance,
java.lang.Iterable<E> itr) |
static <E> int |
countOccurances(E occurance,
java.util.Iterator<E> itr) |
static <E> E |
getElement(int index,
java.lang.Iterable<E> itr)
Does not verify ordering!
|
static <E> E |
getElement(int index,
java.util.Iterator<E> itr)
Does not verify ordering!
|
static <E> E |
getElementOrDefault(int index,
E defaultVal,
java.lang.Iterable<E> itr)
Does not verify ordering!
|
static <E> E |
getElementOrDefault(int index,
E defaultVal,
java.util.Iterator<E> itr)
Does not verify ordering!
|
static <E> E |
getElementOrNull(int index,
java.lang.Iterable<E> itr)
Does not verify ordering!
|
static <E> E |
getElementOrNull(int index,
java.util.Iterator<E> itr)
Does not verify ordering!
|
static int[] |
getLengths(java.lang.Iterable<?> itr)
Iterates over the input iterable while checking if there are any iterable or iterator elements.
|
static int[] |
getLengths(java.util.Iterator<?> itr)
Iterates over the input while checking if there are any iterable or iterator elements.
|
static <K,V> java.util.Map.Entry<K,V> |
getMapEntry(K key,
V val) |
static <K,V> java.util.Map.Entry<K,V> |
getMapEntry(K key,
V val,
boolean mutable) |
static boolean |
matches(@Nullable java.lang.Iterable<?> itr,
@Nullable java.lang.Object value)
Runs non-strict equality rules.
|
static boolean |
matches(@Nullable java.util.Iterator<?> itr,
@Nullable java.lang.Object value)
Runs non-strict equality rules.
|
static boolean |
matchesArray(@Nullable java.lang.Iterable<?> itr,
@Nullable java.lang.Object[] array)
Runs non-strict equality rules.
|
static boolean |
matchesArray(@Nullable java.util.Iterator<?> itr,
@Nullable java.lang.Object[] array)
Runs non-strict equality rules.
|
static boolean |
matchesItr(@Nullable java.lang.Iterable<?> itr,
@Nullable java.lang.Iterable<?> other)
Runs non-strict equality rules.
|
static boolean |
matchesItr(@Nullable java.lang.Iterable<?> itr,
@Nullable java.util.Iterator<?> other)
Runs non-strict equality rules.
|
static boolean |
matchesItr(@Nullable java.util.Iterator<?> itr,
@Nullable java.util.Iterator<?> other)
Runs non-strict equality rules.
|
public static <E> int count(java.lang.Iterable<E> itr)
public static <E> int count(java.util.Iterator<E> itr)
public static <E> int countOccurances(E occurance,
java.lang.Iterable<E> itr)
public static <E> int countOccurances(E occurance,
java.util.Iterator<E> itr)
public static <E> E getElement(int index,
java.lang.Iterable<E> itr)
throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsExceptionpublic static <E> E getElement(int index,
java.util.Iterator<E> itr)
throws java.lang.IndexOutOfBoundsException
java.lang.IndexOutOfBoundsException@Nullable
public static <E> E getElementOrDefault(int index,
E defaultVal,
java.lang.Iterable<E> itr)
public static <E> E getElementOrDefault(int index,
E defaultVal,
java.util.Iterator<E> itr)
@Nullable
public static <E> E getElementOrNull(int index,
java.lang.Iterable<E> itr)
@Nullable
public static <E> E getElementOrNull(int index,
java.util.Iterator<E> itr)
public static int[] getLengths(java.lang.Iterable<?> itr)
public static int[] getLengths(java.util.Iterator<?> itr)
public static <K,V> java.util.Map.Entry<K,V> getMapEntry(K key,
V val)
public static <K,V> java.util.Map.Entry<K,V> getMapEntry(K key,
V val,
boolean mutable)
public static boolean matches(@Nullable
@Nullable java.lang.Iterable<?> itr,
@Nullable
@Nullable java.lang.Object value)
public static boolean matches(@Nullable
@Nullable java.util.Iterator<?> itr,
@Nullable
@Nullable java.lang.Object value)
public static boolean matchesArray(@Nullable
@Nullable java.lang.Iterable<?> itr,
@Nullable
@Nullable java.lang.Object[] array)
public static boolean matchesArray(@Nullable
@Nullable java.util.Iterator<?> itr,
@Nullable
@Nullable java.lang.Object[] array)
public static boolean matchesItr(@Nullable
@Nullable java.lang.Iterable<?> itr,
@Nullable
@Nullable java.lang.Iterable<?> other)
public static boolean matchesItr(@Nullable
@Nullable java.lang.Iterable<?> itr,
@Nullable
@Nullable java.util.Iterator<?> other)
public static boolean matchesItr(@Nullable
@Nullable java.util.Iterator<?> itr,
@Nullable
@Nullable java.util.Iterator<?> other)