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 boolean containsDuplicates​(int[] elements)  
      static int[] exclude​(int[] elements, int[] excludedElements)
      Creates an array with the same order and elements as the original, except the excluded ones.
      static java.util.OptionalInt indexOf​(int[] elements, int element)  
      • 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)
        Creates 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 except the ones that shall be excluded
      • contains

        public static boolean contains​(int[] elements,
                                       int element)
        Checks whether the given element appears anywhere in the given array.
        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
      • indexOf

        public static java.util.OptionalInt indexOf​(int[] elements,
                                                    int element)
        Parameters:
        elements -
        element -
        Returns:
      • containsDuplicates

        public static boolean containsDuplicates​(int[] elements)
        Parameters:
        elements -
        Returns: