Class IntArrayWrapper

    • Constructor Detail

      • IntArrayWrapper

        public IntArrayWrapper​(int[] array)
        Creates a new wrapper with the array. The array can be modified from the outside as not copy is used for performance reasons.
        Parameters:
        array - the array to wrap
    • Method Detail

      • getArray

        public int[] getArray()
      • wrap

        public static IntArrayWrapper wrap​(int... array)
        Convenience method for wrapping a int[] into a IntArrayWrapper.
        Parameters:
        array - the array to wrap
        Returns:
        the wrapped array
      • wrapToList

        public static List<IntArrayWrapper> wrapToList​(Collection<int[]> arrays)
        Convenience method for wrapping all int[] in a collection into a list.
        Parameters:
        arrays - the arrays to wrap
        Returns:
        a list containing the wrapped arrays
      • wrapToSet

        public static Set<IntArrayWrapper> wrapToSet​(Collection<int[]> arrays)
        Convenience method for wrapping all int[] in a collection into a set. As the wrappers contain sensible hashcode and equals functions, no duplicates are present in the set.
        Parameters:
        arrays - the arrays to wrap
        Returns:
        a set containing the wrapped arrays
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object