public final class MoreArrays
extends java.lang.Object
Extra array utilities.
Modifier and Type | Method and Description |
---|---|
static int |
deduplicate(int[] data,
int start,
int end)
Remove duplicate elements in the backing store.
|
static int |
deduplicate(long[] data,
int start,
int end)
Remove duplicate elements in the backing store.
|
static boolean |
isSorted(long[] data,
int start,
int end)
Check that the array is sorted.
|
public static boolean isSorted(long[] data, int start, int end)
Check that the array is sorted. Duplicates are not allowed in a sorted array, by this method’s definition.
data
- The data to test for sortedness.start
- The beginning of the range to test (inclusive)end
- The end of the range to test (exclusive).true
iff the array is sorted.public static int deduplicate(long[] data, int start, int end)
Remove duplicate elements in the backing store. The array should be sorted.
data
- The data to deduplicate.start
- The beginning of the range to deduplicate (inclusive).end
- The end of the range to deduplicate (exclusive).public static int deduplicate(int[] data, int start, int end)
Remove duplicate elements in the backing store. The array should be sorted.
data
- The data to deduplicate.start
- The beginning of the range to deduplicate (inclusive).end
- The end of the range to deduplicate (exclusive).