public final class IntArrayWrapper extends Object
Object.equals(Object) and Object.hashCode() implementation depend only on the storage location
of an array and thus comparing to arrays via equals does not make sense and the hash code does not help either.
This class just wraps the array and uses Arrays.equals(int[], int[]) and Arrays.hashCode(int[]).| Constructor and Description |
|---|
IntArrayWrapper(int[] array)
Creates a new wrapper with the array.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int[] |
getArray() |
int |
hashCode() |
String |
toString() |
static IntArrayWrapper |
wrap(int[] array)
Convenience method for wrapping a int[] into a
IntArrayWrapper. |
static List<IntArrayWrapper> |
wrapToList(Collection<int[]> arrays)
Convenience method for wrapping all int[] in a collection into a list.
|
static Set<IntArrayWrapper> |
wrapToSet(Collection<int[]> arrays)
Convenience method for wrapping all int[] in a collection into a set.
|
public IntArrayWrapper(int[] array)
array - the array to wrappublic int[] getArray()
public static IntArrayWrapper wrap(int[] array)
IntArrayWrapper.array - the array to wrappublic static List<IntArrayWrapper> wrapToList(Collection<int[]> arrays)
arrays - the arrays to wrappublic static Set<IntArrayWrapper> wrapToSet(Collection<int[]> arrays)
arrays - the arrays to wrapCopyright © 2019. All rights reserved.