| java.lang.Object it.unimi.dsi.fastutil.Arrays
Arrays | public class Arrays (Code) | | A class providing static methods and objects that do useful things with arrays.
See Also: Arrays |
Method Summary | |
public static void | ensureFromTo(int arrayLength, int from, int to) Ensures that a range given by its first (inclusive) and last (exclusive) elements fits an array of given length. | public static void | ensureOffsetLength(int arrayLength, int offset, int length) Ensures that a range given by an offset and a length fits an array of given length. |
ensureFromTo | public static void ensureFromTo(int arrayLength, int from, int to)(Code) | | Ensures that a range given by its first (inclusive) and last (exclusive) elements fits an array of given length.
This method may be used whenever an array range check is needed.
Parameters: arrayLength - an array length. Parameters: from - a start index (inclusive). Parameters: to - an end index (inclusive). throws: IllegalArgumentException - if from is greater than to . throws: ArrayIndexOutOfBoundsException - if from or to are greater than arrayLength or negative. |
ensureOffsetLength | public static void ensureOffsetLength(int arrayLength, int offset, int length)(Code) | | Ensures that a range given by an offset and a length fits an array of given length.
This method may be used whenever an array range check is needed.
Parameters: arrayLength - an array length. Parameters: offset - a start index for the fragment Parameters: length - a length (the number of elements in the fragment). throws: IllegalArgumentException - if length is negative. throws: ArrayIndexOutOfBoundsException - if offset is negative or offset +length is greater than arrayLength . |
|
|