public final class ArrayUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
EMPTY_BYTE_ARRAY |
static int |
SIZE_INCREASE |
| Modifier and Type | Method and Description |
|---|---|
static int[] |
copyOf(int[] theArray) |
static int[] |
copyOf(int[] theArray,
int theLength) |
static long[] |
copyOf(long[] theArray) |
static long[] |
copyOf(long[] theArray,
int theLength) |
static <T> T[] |
copyOf(T[] theArray) |
static <T> T[] |
copyOf(T[] theArray,
int theLength) |
static <T> int |
deferredEqualityBinarySearch(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator)
Implementation of a binary search which uses the deferred equality approach.
|
static <T> int |
deferredEqualityBinarySearchAfter(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator)
Deferred equality binary search
with the position returned normalized after. |
static <T> int |
deferredEqualityBinarySearchBefore(T[] theData,
T theElement,
Comparator<T> theComparator) |
static <T> int |
deferredEqualityBinarySearchBefore(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator) |
static <T> void |
delete(long[] data,
int size,
int pos) |
static <T> void |
delete(T[] data,
int size,
int pos) |
static <T> T[] |
ensureSize(T[] theArray,
int newSize) |
static <T> T[] |
increaseSize(T[] theArray) |
static long[] |
insert(long[] data,
int size,
int pos,
long theElement) |
static <T> T[] |
insert(T[] data,
int size,
int pos,
T theElement) |
static <T> com.google.common.collect.PeekingIterator<T> |
iterator(T[] theArray)
Iterator for the given array |
static <T> com.google.common.collect.PeekingIterator<T> |
iterator(T[] theArray,
int theStart,
int theEnd)
Iterator for the given array |
static byte[] |
merge(byte[] theFirst,
byte[] theSecond) |
static <T> int |
merge(T[] theFirstArray,
int theFirstSize,
T[] theSecondArray,
int theSecondSize,
T[] theResult,
Comparator<T> theComparator)
Merges two sorted arrays without duplicates into a new array.
|
static <T> T[] |
newArray(int theLength) |
static int |
normalizeAfter(int thePosition) |
static int |
normalizeBefore(int thePosition) |
static boolean |
rangeEquals(byte[] bytes1,
int offset1,
byte[] bytes2,
int offset2,
int length) |
static <T> int |
removeDuplicates(T[] theSortedArray,
int theSize)
Removes duplicates from a sorted array by moving the unique elements to the front of the array and returns the
number of unique elements.
|
static <T> int |
removeDuplicates(T[] theSortedArray,
int theSize,
Comparator<T> theComparator) |
static <T> int |
search(T[] theArray,
T theObject,
Comparator<T> theComparator) |
static <T> int |
search(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator) |
static <T> int |
searchAfter(T[] theArray,
T theObject,
Comparator<T> theComparator) |
static <T> int |
searchAfter(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator) |
static <T> int |
searchBefore(T[] theArray,
T theObject,
Comparator<T> theComparator) |
static <T> int |
searchBefore(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator) |
static int |
sequentialSearch(long[] theArray,
int theSize,
long theElement) |
static <T> int |
sequentialSearch(T[] theArray,
int theSize,
T theElement) |
static <T> void |
sort(T[] theArray,
Comparator<T> theComparator) |
static <T> void |
sort(T[] theArray,
int theStart,
int theEnd,
Comparator<? super T> theComparator) |
public static final int SIZE_INCREASE
public static final byte[] EMPTY_BYTE_ARRAY
public static <T> com.google.common.collect.PeekingIterator<T> iterator(T[] theArray,
int theStart,
int theEnd)
Iterator for the given arrayT - theArray - The Array to iterate overtheStart - The starting point (inclusive)theEnd - The ending point (exclusive)public static <T> com.google.common.collect.PeekingIterator<T> iterator(T[] theArray)
Iterator for the given arrayT - theArray - The Array to iterate overpublic static <T> int search(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator)
public static <T> int search(T[] theArray,
T theObject,
Comparator<T> theComparator)
public static <T> int searchAfter(T[] theArray,
T theObject,
Comparator<T> theComparator)
T - theArray - theObject - theComparator - public static <T> int searchAfter(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator)
public static <T> int deferredEqualityBinarySearch(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator)
T - the type of elements in the arraytheData - the array to searchtheElement - the element to search fortheStart - the start position, inclusivetheEnd - the end position, exclusivetheComparator - the comparatorArrays.binarySearch(long[], long)public static <T> int deferredEqualityBinarySearchAfter(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator)
Deferred equality binary search
with the position returned normalized after.T - the type of elements in the arraytheData - the array to searchtheElement - the element to search fortheStart - the start index of the searchtheEnd - the end index of the searchtheComparator - the comparatorpublic static <T> int deferredEqualityBinarySearchBefore(T[] theData,
T theElement,
Comparator<T> theComparator)
public static <T> int deferredEqualityBinarySearchBefore(T[] theData,
T theElement,
int theStart,
int theEnd,
Comparator<T> theComparator)
public static <T> int searchBefore(T[] theArray,
T theObject,
Comparator<T> theComparator)
T - theArray - theObject - theComparator - public static <T> int searchBefore(T[] theArray,
T theObject,
int theStart,
int theEnd,
Comparator<T> theComparator)
public static <T> T[] copyOf(T[] theArray)
public static int normalizeAfter(int thePosition)
public static int normalizeBefore(int thePosition)
public static <T> T[] increaseSize(T[] theArray)
public static <T> T[] ensureSize(T[] theArray,
int newSize)
public static <T> T[] copyOf(T[] theArray,
int theLength)
public static long[] copyOf(long[] theArray)
public static long[] copyOf(long[] theArray,
int theLength)
public static int[] copyOf(int[] theArray)
public static int[] copyOf(int[] theArray,
int theLength)
public static <T> T[] newArray(int theLength)
public static int sequentialSearch(long[] theArray,
int theSize,
long theElement)
public static <T> int sequentialSearch(T[] theArray,
int theSize,
T theElement)
public static <T> void sort(T[] theArray,
int theStart,
int theEnd,
Comparator<? super T> theComparator)
public static <T> void sort(T[] theArray,
Comparator<T> theComparator)
public static byte[] merge(byte[] theFirst,
byte[] theSecond)
public static <T> int removeDuplicates(T[] theSortedArray,
int theSize)
theSortedArray - a sorted array that possibly contains duplicatestheSize - the size of the array that contains valid elements, elements beyond this index are completely ignoredpublic static <T> int removeDuplicates(T[] theSortedArray,
int theSize,
Comparator<T> theComparator)
public static <T> int merge(T[] theFirstArray,
int theFirstSize,
T[] theSecondArray,
int theSecondSize,
T[] theResult,
Comparator<T> theComparator)
T - theFirstArray - the first array to be mergedtheFirstSize - the size of valid elements in the first arraytheSecondArray - the second array to be mergedtheSecondSize - the size of valid elements in the second arraytheResult - the result array where elements will be copiedtheComparator - the comparator for the elementpublic static <T> void delete(T[] data,
int size,
int pos)
public static <T> void delete(long[] data,
int size,
int pos)
public static <T> T[] insert(T[] data,
int size,
int pos,
T theElement)
public static long[] insert(long[] data,
int size,
int pos,
long theElement)
public static boolean rangeEquals(byte[] bytes1,
int offset1,
byte[] bytes2,
int offset2,
int length)
Copyright © 2010-2016 Stardog Union. All Rights Reserved.