Class ArrayUtil


  • public final class ArrayUtil
    extends java.lang.Object
    Common operations which need to be performed on arrays in combinatorial test input generation.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean contains​(int[] elements, int element)
      Checks whether the given element appears anywhere in the given array.
      static int[] exclude​(int[] elements, int[] excludedElements)
      Calculates an array with the same order and elements as the original, except the excluded ones.
      • Methods inherited from class java.lang.Object

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

      • exclude

        public static int[] exclude​(int[] elements,
                                    int[] excludedElements)
        Calculates an array with the same order and elements as the original, except the excluded ones. For example, if elements is [0, 5, 3, 2, 5, 2], and excluded elements is [5, 6], then [0, 3, 2, 2] is the result.
        Parameters:
        elements - all elements. Must not be null
        excludedElements - the ones which are be excluded (duplicates don't matter). Most not be null
        Returns:
        all elements exception the ones which shall be excluded
      • contains

        public static boolean contains​(int[] elements,
                                       int element)
        Checks whether the given element appears anywhere in the given array. If the given array is empty, the element cannot appear in it and therefore null is returned.
        Parameters:
        elements - all elements which are searched. Must not be null
        element - the element for which is searched
        Returns:
        whether the given element appears in the given elements at any arbitrary index