Class CollectionUtils

java.lang.Object
org.evrete.util.CollectionUtils

public final class CollectionUtils extends Object
The CollectionUtils class provides utility methods for working with collections.
  • Constructor Details

    • CollectionUtils

      public CollectionUtils()
  • Method Details

    • array

      public static <T> T[] array(Class<T> type, int size)
    • copyOf

      public static <T> T[] copyOf(T[] arr)
    • emptyReIterator

      public static <T> ReIterator<T> emptyReIterator()
    • permutation

      public static <E> List<List<E>> permutation(List<E> l)
    • combinations

      public static <E, T extends Collection<E>> Collection<List<E>> combinations(Collection<T> sources)
      For argument like [[a1, a2, a3], [b1, b2], [c1, c2]] method returns collection of size L = a.size() * b.size() * c.size() = 12 where each entry is a combination of the three input sources: [a1, b1 ,c1], [a1, b1, c2], [a1, b2, c1] .... [a3, b3, c2]
      Type Parameters:
      E - source type parameter
      T - collection type parameter
      Parameters:
      sources - input collections
      Returns:
      all possible combinations
    • systemFill

      public static void systemFill(int[] array, int value)
    • systemFill

      public static void systemFill(boolean[] array, boolean value)
    • systemFill

      public static <T> void systemFill(T[] array, T value)