Package de.aristaflow.adept2.util
Class ArrayTools.ArrayWrapper<T>
- java.lang.Object
-
- de.aristaflow.adept2.util.ArrayTools.ArrayWrapper<T>
-
- Type Parameters:
T- The type of an element of the array.
- Enclosing class:
- ArrayTools
public static class ArrayTools.ArrayWrapper<T> extends Object
A wrapper for arrays that provide a useful (i. e. deep)equals(Object),hashCode()andtoString().
Equality requires the objects to be compared to beArrayWrapper. Only then the arrays will be unwrapped and compared. Comparing anArrayWrapperwith a normal array will yieldfalse.
-
-
Constructor Summary
Constructors Constructor Description ArrayWrapper(T[] array)Creates a new wrapped array for designated array.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)T[]getArray()Gets the wrapped array.inthashCode()StringtoString()
-
-
-
Field Detail
-
array
protected final T[] array
The wrapped array.
-
-
Constructor Detail
-
ArrayWrapper
public ArrayWrapper(T[] array)
Creates a new wrapped array for designated array. This does not clone the array, so beware of side-effects! Changing elements of the array will also change the implementedhashCode()andequals(Object).- Parameters:
array- The array to be wrapped. This does not clone the array, so beware of side-effects!
-
-
Method Detail
-
getArray
public T[] getArray()
Gets the wrapped array. This is not a clone, so beware of side-effects! Changing elements of the array will also change the implementedhashCode()andequals(Object).- Returns:
- The wrapped array. This is not a clone, so beware of side-effects!
-
-