Class ArrayUtilities


  • public class ArrayUtilities
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayUtilities()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int[] concatenate​(int[] a, int[] b)
      Returns a new array containing the elements of a followed by the elements of b.
      static <X> X[] concatenate​(X[] a, X[] b)
      Returns a new array containing the elements of a followed by the elements of b.
      static <X> boolean contains​(X[] a, X b)
      Returns whether a contains b.
      static <X extends java.lang.Comparable<X>>
      X[]
      difference​(X[] a, X[] b)
      Returns a new array containing all elements in a but not in b.
      static <X> X[] findArrayWith​(X[][] a, X b)
      Returns the first array within a in which b occurs, or null if b does not occur anywhere.
      static <X> java.util.Set<X> toSet​(X[] a)
      Returns a set containing the elements of the array
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ArrayUtilities

        public ArrayUtilities()
    • Method Detail

      • toSet

        public static <X> java.util.Set<X> toSet​(X[] a)
        Returns a set containing the elements of the array
        Parameters:
        a -
        Returns:
      • concatenate

        public static <X> X[] concatenate​(X[] a,
                                          X[] b)
        Returns a new array containing the elements of a followed by the elements of b.
        Parameters:
        a -
        b -
        Returns:
      • concatenate

        public static int[] concatenate​(int[] a,
                                        int[] b)
        Returns a new array containing the elements of a followed by the elements of b.
        Parameters:
        a -
        b -
        Returns:
      • contains

        public static <X> boolean contains​(X[] a,
                                           X b)
        Returns whether a contains b.
        Parameters:
        a -
        b -
        Returns:
      • difference

        public static <X extends java.lang.Comparable<X>> X[] difference​(X[] a,
                                                                         X[] b)
        Returns a new array containing all elements in a but not in b.
        Parameters:
        a -
        b -
        Returns:
      • findArrayWith

        public static <X> X[] findArrayWith​(X[][] a,
                                            X b)
        Returns the first array within a in which b occurs, or null if b does not occur anywhere.
        Parameters:
        a -
        b -
        Returns: