Class IntegerListUtils


  • public class IntegerListUtils
    extends Object
    Utilities for integer lists
    • Constructor Detail

      • IntegerListUtils

        public IntegerListUtils()
    • Method Detail

      • getLongestConsecutiveSubList

        public static List<Integer> getLongestConsecutiveSubList​(int offsetIndex,
                                                                 List<Integer> intList)
        extract a sublist of the first consecutive range of integers found in the given list, e.g., without gaps so for 0,2,4,6,7,8,9,10,12 with offset 5, we find ,8,9,10. In case offset is 0, we only get 0 back
        Parameters:
        offsetIndex - (inclusive)
        intList - to extract longest sublist from
        Returns:
        sublist, empty if out of range
      • rangeOf

        public static List<Integer> rangeOf​(int start,
                                            int end)
        Create a range between start and end
        Parameters:
        start - inclusive
        end - exclusive
        Returns:
        integer list in ascending order