|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkodkod.util.collections.Arrays
public final class Arrays
This class provides utility methods for constructing iterators over arrays and convenience wrappers for java.util.Arrays sorting and searching procedures.
Method Summary | ||
---|---|---|
static
|
asIdentitySet(T[] array)
Returns an identity set backed by the given array. |
|
static
|
emptyIterator()
Returns an iterator that has no elements. |
|
static int |
identityBinarySearch(java.lang.Object[] array,
java.lang.Object key)
Searches the specified array for the specified object using the binary search algorithm and reference equality. |
|
static java.util.Comparator<java.lang.Object> |
identityComparator()
Returns a comparator that compares objects according to their identity hashcodes . |
|
static
|
identitySort(T[] array)
Calls Arrays.sort(Object[], Comparator) on the
given array and returns it. |
|
static
|
iterate(E... items)
Returns a new iterator over the given array of items. |
|
static
|
iterate(int start,
int end,
E... items)
Returns a new iterator over the given array of items. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static final <T,E extends T> java.util.Iterator<T> iterate(E... items)
java.lang.NullPointerException
- - items = nullpublic static final <T,E extends T> java.util.Iterator<T> iterate(int start, int end, E... items)
java.lang.NullPointerException
- - items = null
java.lang.IllegalArgumentException
- - start < end && (start < 0 || end > items.length) ||
start > end && (start >= items.length || end < -1)public static final <T> java.util.Iterator<T> emptyIterator()
public static final java.util.Comparator<java.lang.Object> identityComparator()
identity hashcodes
.
identity hashcodes
.public static final <T> T[] identitySort(T[] array)
Arrays.sort(Object[], Comparator)
on the
given array and returns it. The elements are sorted in the ascending
order of their identity hashcodes.
java.util.Arrays.sort(array, {@link #identityComparator()}) |
public static final int identityBinarySearch(java.lang.Object[] array, java.lang.Object key)
identitySort(Object[])
) prior to making this call. If it is not sorted,
the results are undefined. If the array contains multiple occurences of the specified object,
there is no guarantee which one will be found.
all i, j: [0..array.length) | i < j => System.identityHashCode(array[i]) <= System.identityHashCode(array[j]) |
public static final <T> java.util.Set<T> asIdentitySet(T[] array)
identitySort(Object[])
), and its contents
must not be changed while it is in use by the returned set.
all i, j: [0..array.length) | i < j => System.identityHashCode(array[i]) <= System.identityHashCode(array[j]) |
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |