Class Collectors

java.lang.Object
org.apache.drill.common.collections.Collectors

public class Collectors extends Object
  • Method Details

    • toList

      public static <T, K, V> List<T> toList(Map<K,V> map, BiFunction<K,V,T> mapper)
      Type Parameters:
      T - elements type in List
      K - key type in Map
      V - value type in Map
      Parameters:
      map - Map<K, V> to collect elements from
      mapper - BiFunction that maps from (key, value) pair to type
      Returns:
      new List that contains elements after applying mapper BiFunction to the input Map
    • toList

      public static <T, K, V> List<T> toList(Map<K,V> map, BiFunction<K,V,T> mapper, Predicate<T> predicate)
      Type Parameters:
      T - elements type in List
      K - keys type in Map
      V - value type in Map
      Parameters:
      map - Map<K, V> to collect elements from
      mapper - BiFunction that maps from (key, value) pair to type
      predicate - Predicate filter to apply
      Returns:
      new List that contains elements that satisfy Predicate after applying mapper BiFunction to the input Map
    • collect

      public static <T, K, V> List<T> collect(List<T> list, Map<K,V> map, BiFunction<K,V,T> mapper)
    • collect

      public static <T, K, V> List<T> collect(List<T> list, Map<K,V> map, BiFunction<K,V,T> mapper, Predicate<T> predicate)
    • toList

      public static <T, E> List<T> toList(Collection<E> collection, Function<E,T> mapper)
      Type Parameters:
      T - elements type in List
      E - elements type in Collection
      Parameters:
      collection - Collection<E> of elements of type
      mapper - Function<E, T> mapper function to apply
      Returns:
      new List that contains elements that satisfy Predicate after applying mapper Function to the input Collection
    • toList

      public static <T, E> List<T> toList(Collection<E> collection, Function<E,T> mapper, Predicate<T> predicate)
      Type Parameters:
      T - elements type in List
      E - elements type in Collection
      Parameters:
      collection - Collection<E> of elements of type
      mapper - Function<E, T> mapper function to apply
      predicate - Predicate filter to apply
      Returns:
      new List that contains elements after applying mapper Function to the input Collection