Package org.goplanit.utils.containers
Class IntegerListUtils
- java.lang.Object
-
- org.goplanit.utils.containers.IntegerListUtils
-
public class IntegerListUtils extends Object
Utilities for integer lists
-
-
Constructor Summary
Constructors Constructor Description IntegerListUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static List<Integer>
rangeOf(int start, int end)
Create a range between start and end
-
-
-
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
-
-