Class CollectionUtil

java.lang.Object
org.spockframework.util.CollectionUtil

public abstract class CollectionUtil extends Object
  • Constructor Details

    • CollectionUtil

      public CollectionUtil()
  • Method Details

    • filterMap

      public static <E, F> ArrayList<F> filterMap(Collection<E> collection, IFunction<? super E,? extends F> function)
    • copyArray

      public static Object[] copyArray(Object[] array, int from, int to)
      (Partial) replacement for Arrays.copyOfRange, which is only available in JDK6.
    • arrayToList

      public static List<Object> arrayToList(Object array)
    • getFirstElement

      public static <T> T getFirstElement(Iterable<T> iterable)
    • getLastElement

      public static <T> T getLastElement(List<T> list)
    • setLastElement

      public static <T> void setLastElement(List<T> list, T elem)
    • addLastElement

      public static <T> void addLastElement(List<T> list, T element)
    • reverse

      public static <T> Iterable<T> reverse(List<T> list)
    • asSet

      public static <T> Set<T> asSet(T[] values)
    • listOf

      public static <E> List<E> listOf(E... elements)
    • mapOf

      public static <K, V> Map<K,V> mapOf(K key, V value)
    • mapOf

      public static <K, V> Map<K,V> mapOf(K key, V value, K key2, V value2)
    • mapOf

      public static <K, V> Map<K,V> mapOf(K key, V value, K key2, V value2, K key3, V value3)
    • mapOf

      public static <K, V> Map<K,V> mapOf(K key, V value, K key2, V value2, K key3, V value3, K key4, V value4)
    • mapOf

      public static <K, V> Map<K,V> mapOf(K key, V value, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5)
    • filterNullValues

      public static Map filterNullValues(Map map)
    • putAll

      public static Map putAll(Map original, Map... others)
    • concat

      public static <T> Iterable<T> concat(Iterable<? extends T>... iterables)
    • concat

      public static <T> Iterable<T> concat(List<Iterable<? extends T>> iterables)
    • containsAny

      public static boolean containsAny(Iterable<?> iterable, Object... elements)
    • findIndexOf

      public static <T> int findIndexOf(Iterable<T> iterable, IFunction<? super T,Boolean> predicate)