Class Index<T>
- java.lang.Object
-
- com.identityworksllc.iiq.common.iterators.Index<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getIndex()
Gets the integer index valueT
getValue()
The value at that position in the liststatic <In> Iterator<Index<In>>
with(Iterator<? extends In> iterator)
Implements an equivalent to Javascript’s eachWithIndex.static <In> Iterable<Index<In>>
with(List<? extends In> iterable)
Implements an equivalent to Javascript’s eachWithIndex.
-
-
-
Method Detail
-
with
public static <In> Iterator<Index<In>> with(Iterator<? extends In> iterator)
Implements an equivalent to Javascript’s eachWithIndex.This is a shortcut to
IndexingIterator
. If the input is null, a constant empty iterator is returned.- Type Parameters:
In
- The type of the values in the list- Parameters:
iterator
- The input list to iterate over- Returns:
- An indexed iterator over the given child iterator
-
with
public static <In> Iterable<Index<In>> with(List<? extends In> iterable)
Implements an equivalent to Javascript’s eachWithIndex.If the input is null or empty, a constant empty Iterable is returned.
The output of this method is not itself a List.
- Type Parameters:
In
- The type of the values in the list- Parameters:
iterable
- The input list to iterate over- Returns:
- An indexed iterator over the given list
-
getIndex
public int getIndex()
Gets the integer index value- Returns:
- The integer index value
-
-