Class CollapseRunsSpec<T,K,V>

java.lang.Object
org.aksw.commons.util.stream.CollapseRunsSpecBase<T,K,V>
org.aksw.commons.util.stream.CollapseRunsSpec<T,K,V>
Type Parameters:
T - Item type
K - Group key type
V - Accumulator type

public class CollapseRunsSpec<T,K,V> extends CollapseRunsSpecBase<T,K,V>
Specification implementation. Provides several create methods for constructing a spec about how to collapse runs.
Author:
raven
  • Constructor Details

  • Method Details

    • createAcc

      public static <T, K, V> CollapseRunsSpec<T,K,V> createAcc(Function<? super T,? extends K> getGroupKey, Supplier<? extends V> accCtor, BiFunction<? super V,? super T,? extends V> accAdd)
      Create method with the following characteristics:
      • the accumulator constructor is a mere supplier (and thus neither depends on the accumulator count nor the group Key)
      • Group keys are compared using Objects::equals
    • createAcc

      public static <T, K, V> CollapseRunsSpec<T,K,V> createAcc(Function<? super T,? extends K> getGroupKey, Function<? super K,? extends V> accCtor, BiFunction<? super V,? super T,? extends V> accAdd)
      Create method with the following characteristics:
      • the accumulator constructor receives the group key
      • Group keys are compared using Objects::equals
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, Function<? super K,? extends V> accCtor, BiConsumer<? super V,? super T> accAdd)
      Create method with the following characteristics:
      • the accumulator constructor receives the group key
      • Group keys are compared using Objects::equals
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, Supplier<? extends V> accCtor, BiConsumer<? super V,? super T> accAdd)
    • createList

      public static <T, K> CollapseRunsSpec<T,K,List<T>> createList(Function<? super T,? extends K> getGroupKey)
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, BiFunction<? super Long,? super K,? extends V> accCtor, BiConsumer<? super V,? super T> accAdd)
      Create method with the following characteristics:
      • the accumulator constructor receives the number of so-far created accumulators (starting with 0) and the group key
      • Group keys are compared using Objects::equals
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, BiPredicate<? super K,? super K> groupKeyCompare, Function<? super K,? extends V> accCtor, BiFunction<? super V,? super T,? extends V> accAdd)
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, BiPredicate<? super K,? super K> groupKeyCompare, Function<? super K,? extends V> accCtor, BiConsumer<? super V,? super T> accAdd)
    • create

      public static <T, K, V> CollapseRunsSpec<T,K,V> create(Function<? super T,? extends K> getGroupKey, BiPredicate<? super K,? super K> groupKeyCompare, BiFunction<? super Long,? super K,? extends V> accCtor, BiFunction<? super V,? super T,? extends V> accAdd)