Class Lists


  • public class Lists
    extends Object
    List utility methods
    • Constructor Detail

      • Lists

        public Lists()
    • Method Detail

      • toIndexedStream

        public static <T> Stream<Pair<Integer,​T>> toIndexedStream​(List<T> list)
        Convert the list to an 0-based Indexed Stream consisting of Pair's, where each Pair consists 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 a Stream of:
        • 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