Package org.aksw.commons.util.stream
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 typeK- Group key typeV- Accumulator type
Specification implementation.
Provides several create methods for constructing a spec about how to collapse runs.
- Author:
- raven
-
Field Summary
Fields inherited from class org.aksw.commons.util.stream.CollapseRunsSpecBase
accAdd, accCtor, getGroupKey, groupKeyCompare -
Constructor Summary
ConstructorsConstructorDescriptionCollapseRunsSpec(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) CollapseRunsSpec(CollapseRunsSpecBase<T, K, V> other) -
Method Summary
Modifier and TypeMethodDescriptionstatic <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::equalsstatic <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) 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) 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) 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::equalsstatic <T,K, V> CollapseRunsSpec<T, K, V> create(Function<? super T, ? extends K> getGroupKey, Supplier<? extends V> accCtor, BiConsumer<? super V, ? super T> accAdd) 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::equalsstatic <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::equalsstatic <T,K> CollapseRunsSpec<T, K, List<T>> createList(Function<? super T, ? extends K> getGroupKey)
-
Constructor Details
-
CollapseRunsSpec
-
CollapseRunsSpec
public CollapseRunsSpec(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)
-
-
Method Details
-
createAcc
public static <T,K, CollapseRunsSpec<T,V> K, createAccV> (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, CollapseRunsSpec<T,V> K, createAccV> (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, CollapseRunsSpec<T,V> K, createV> (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, CollapseRunsSpec<T,V> K, createV> (Function<? super T, ? extends K> getGroupKey, Supplier<? extends V> accCtor, BiConsumer<? super V, ? super T> accAdd) -
createList
public static <T,K> CollapseRunsSpec<T,K, createListList<T>> (Function<? super T, ? extends K> getGroupKey) -
create
public static <T,K, CollapseRunsSpec<T,V> K, createV> (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, CollapseRunsSpec<T,V> K, createV> (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, CollapseRunsSpec<T,V> K, createV> (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, CollapseRunsSpec<T,V> K, createV> (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)
-