Class Lists
- java.lang.Object
-
- dk.cloudcreate.essentials.shared.collections.Lists
-
-
Constructor Summary
Constructors Constructor Description Lists()
-
-
-
Method Detail
-
toIndexedStream
public static <T> Stream<Pair<Integer,T>> toIndexedStream(List<T> list)
Convert thelistto an 0-based Indexed Stream consisting ofPair's, where eachPairconsists of the 0-based Index (i.e. the first index has value 0) and the corresponding List element at the given index:Pair<Index, List-element-at-the-given-index>
Example:
List.of("A", "B", "C") will return aStreamof:- Pair(0, "A")
- Pair(1, "B")
- Pair(2, "C")
- Type Parameters:
T- the type of list element- Parameters:
list- the list that's converted to an indexed stream- Returns:
- the indexed list
-
-