public abstract class Groups extends Object
| Constructor and Description |
|---|
Groups() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> Map<K,List<V>> |
groupBy(Iterable<V> groupies,
Function<V,K> grouper)
Groups elements from an iterable in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>> |
groupBy(Iterable<V> groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider)
Groups elements from an iterable in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>,M extends Map<K,C>> |
groupBy(Iterable<V> groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider,
Supplier<M> mapProvider)
Groups elements from an iterable in the key evaluated from the passed
function.
|
static <K,V> Map<K,List<V>> |
groupBy(Iterator<V> groupies,
Function<V,K> grouper)
Groups elements from an iterator in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>> |
groupBy(Iterator<V> groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider)
Groups elements from an iterator in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>,M extends Map<K,C>> |
groupBy(Iterator<V> groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider,
Supplier<M> mapProvider)
Groups elements from an iterator in the key evaluated from the passed
function.
|
static <K,V> Map<K,List<V>> |
groupBy(V[] groupies,
Function<V,K> grouper)
Groups elements from an array in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>> |
groupBy(V[] groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider)
Groups elements from an array in the key evaluated from the passed
function.
|
static <K,V,C extends Collection<V>,M extends Map<K,C>> |
groupBy(V[] groupies,
Function<V,K> grouper,
Supplier<C> collectionProvider,
Supplier<M> mapProvider)
Groups elements from an array in the key evaluated from the passed
function.
|
static <K,V> Map<K,V> |
indexBy(Iterable<V> groupies,
Function<V,K> indexer)
Indexes elements from the iterable using passed function.
|
static <K,V,M extends Map<K,V>> |
indexBy(Iterable<V> groupies,
Function<V,K> indexer,
Supplier<M> mapProvider)
Indexes elements from the iterable using passed function.
|
static <K,V> Map<K,V> |
indexBy(Iterator<V> groupies,
Function<V,K> indexer)
Indexes elements from the iterator using passed function.
|
static <K,V,M extends Map<K,V>> |
indexBy(Iterator<V> groupies,
Function<V,K> indexer,
Supplier<M> mapProvider)
Indexes elements from the iterator using passed function.
|
static <K,V> Map<K,V> |
indexBy(V[] groupies,
Function<V,K> indexer)
Indexes elements from the array using passed function.
|
static <K,V,M extends Map<K,V>> |
indexBy(V[] groupies,
Function<V,K> indexer,
Supplier<M> mapProvider)
Indexes elements from the array using passed function.
|
static <T> Pair<List<T>,List<T>> |
partition(Iterable<T> values,
Predicate<T> partitioner)
Partitions elements from the iterable into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,C extends Collection<T>> |
partition(Iterable<T> values,
Predicate<T> partitioner,
Supplier<C> collectionsProvider)
Partitions elements from the iterable into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,CA extends Collection<T>,CR extends Collection<T>> |
partition(Iterable<T> values,
Predicate<T> partitioner,
Supplier<CA> acceptedCollectionProvider,
Supplier<CR> refusedCollectionProvider)
Partitions elements from the iterable into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T> Pair<List<T>,List<T>> |
partition(Iterator<T> values,
Predicate<T> partitioner)
Partitions elements from the iterator into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,C extends Collection<T>> |
partition(Iterator<T> values,
Predicate<T> partitioner,
Supplier<C> collectionsProvider)
Partitions elements from the iterator into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,CA extends Collection<T>,CR extends Collection<T>> |
partition(Iterator<T> values,
Predicate<T> partitioner,
Supplier<CA> acceptedCollectionProvider,
Supplier<CR> refusedCollectionProvider)
Partitions elements from the iterator into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T> Pair<List<T>,List<T>> |
partition(T[] values,
Predicate<T> partitioner)
Partitions elements from the array into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,C extends Collection<T>> |
partition(T[] values,
Predicate<T> partitioner,
Supplier<C> collectionsProvider)
Partitions elements from the array into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
static <T,CA extends Collection<T>,CR extends Collection<T>> |
partition(T[] values,
Predicate<T> partitioner,
Supplier<CA> acceptedCollectionProvider,
Supplier<CR> refusedCollectionProvider)
Partitions elements from the array into two collections containing
elements that match the predicate (left side collection) and elements
that don't (right side collection).
|
public static <K,V> Map<K,List<V>> groupBy(Iterator<V> groupies, Function<V,K> grouper)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typegroupies - the elements to be groupedgrouper - the function used to group elementspublic static <K,V,C extends Collection<V>> Map<K,C> groupBy(Iterator<V> groupies, Function<V,K> grouper, Supplier<C> collectionProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapgroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection supplierpublic static <K,V,C extends Collection<V>,M extends Map<K,C>> Map<K,C> groupBy(Iterator<V> groupies, Function<V,K> grouper, Supplier<C> collectionProvider, Supplier<M> mapProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapM - the result map typegroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection suppliermapProvider - the map collection supplierpublic static <K,V> Map<K,List<V>> groupBy(Iterable<V> groupies, Function<V,K> grouper)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typegroupies - the elements to be groupedgrouper - the function used to group elementspublic static <K,V,C extends Collection<V>> Map<K,C> groupBy(Iterable<V> groupies, Function<V,K> grouper, Supplier<C> collectionProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapgroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection supplierpublic static <K,V,C extends Collection<V>,M extends Map<K,C>> Map<K,C> groupBy(Iterable<V> groupies, Function<V,K> grouper, Supplier<C> collectionProvider, Supplier<M> mapProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapM - the result map typegroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection suppliermapProvider - the map collection supplierpublic static <K,V> Map<K,List<V>> groupBy(V[] groupies, Function<V,K> grouper)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typegroupies - the elements to be groupedgrouper - the function used to group elementspublic static <K,V,C extends Collection<V>> Map<K,C> groupBy(V[] groupies, Function<V,K> grouper, Supplier<C> collectionProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapgroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection supplierpublic static <K,V,C extends Collection<V>,M extends Map<K,C>> Map<K,C> groupBy(V[] groupies, Function<V,K> grouper, Supplier<C> collectionProvider, Supplier<M> mapProvider)
groupBy([1, 2, 3, 1], id) -> { 1: [1,1], 2: [2], 3: [3]}K - the grouped key typeV - the grouped value typeC - the collection type used as value of the mapM - the result map typegroupies - the elements to be groupedgrouper - the function used to group elementscollectionProvider - the values collection suppliermapProvider - the map collection supplierpublic static <T> Pair<List<T>,List<T>> partition(Iterator<T> values, Predicate<T> partitioner)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typevalues - the values to be partitionedpartitioner - the predicate used to partition valuespublic static <T,C extends Collection<T>> Pair<C,C> partition(Iterator<T> values, Predicate<T> partitioner, Supplier<C> collectionsProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typeC - the partitioned elements collection typevalues - the values to be partitionedpartitioner - the predicate used to partition valuescollectionsProvider - a collection supplier used to create both
elements collectionpublic static <T,CA extends Collection<T>,CR extends Collection<T>> Pair<CA,CR> partition(Iterator<T> values, Predicate<T> partitioner, Supplier<CA> acceptedCollectionProvider, Supplier<CR> refusedCollectionProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])CA - the accepted elements collection typeCR - the refused elements collection typeT - the element typevalues - the values to be partitionedpartitioner - the predicate used to partition valuesacceptedCollectionProvider - a collection supplier used to create
accepted elements collectionrefusedCollectionProvider - a collection supplier used to create
refused elements collectionpublic static <T> Pair<List<T>,List<T>> partition(Iterable<T> values, Predicate<T> partitioner)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typevalues - the values to be partitionedpartitioner - the predicate used to partition valuespublic static <T,C extends Collection<T>> Pair<C,C> partition(Iterable<T> values, Predicate<T> partitioner, Supplier<C> collectionsProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typeC - the partitioned elements collection typevalues - the values to be partitionedpartitioner - the predicate used to partition valuescollectionsProvider - a collection supplier used to create both
elements collectionpublic static <T,CA extends Collection<T>,CR extends Collection<T>> Pair<CA,CR> partition(Iterable<T> values, Predicate<T> partitioner, Supplier<CA> acceptedCollectionProvider, Supplier<CR> refusedCollectionProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typeCA - the accepted elements collection typeCR - the refused elements collection typevalues - the values to be partitionedpartitioner - the predicate used to partition valuesacceptedCollectionProvider - a collection supplier used to create
accepted elements collectionrefusedCollectionProvider - a collection supplier used to create
refused elements collectionpublic static <T> Pair<List<T>,List<T>> partition(T[] values, Predicate<T> partitioner)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typevalues - the values to be partitionedpartitioner - the predicate used to partition valuespublic static <T,C extends Collection<T>> Pair<C,C> partition(T[] values, Predicate<T> partitioner, Supplier<C> collectionsProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])T - the element typeC - the partitioned elements collection typevalues - the values to be partitionedpartitioner - the predicate used to partition valuescollectionsProvider - a collection supplier used to create both
elements collectionpublic static <T,CA extends Collection<T>,CR extends Collection<T>> Pair<CA,CR> partition(T[] values, Predicate<T> partitioner, Supplier<CA> acceptedCollectionProvider, Supplier<CR> refusedCollectionProvider)
partition([1,2,3,4], isOdd) -> ([1,3],[2,4])CA - the accepted elements collection typeCR - the refused elements collection typeT - the element typevalues - the values to be partitionedpartitioner - the predicate used to partition valuesacceptedCollectionProvider - a collection supplier used to create
accepted elements collectionrefusedCollectionProvider - a collection supplier used to create
refused elements collectionpublic static <K,V,M extends Map<K,V>> Map<K,V> indexBy(Iterable<V> groupies, Function<V,K> indexer, Supplier<M> mapProvider)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typeM - the map typegroupies - elements to be indexedindexer - the function used to index elementsmapProvider - a supplier used to create the resulting mappublic static <K,V> Map<K,V> indexBy(Iterable<V> groupies, Function<V,K> indexer)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typegroupies - elements to be indexedindexer - the function used to index elementspublic static <K,V,M extends Map<K,V>> Map<K,V> indexBy(Iterator<V> groupies, Function<V,K> indexer, Supplier<M> mapProvider)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typeM - the map typegroupies - elements to be indexedindexer - the function used to index elementsmapProvider - a supplier used to create the resulting mappublic static <K,V> Map<K,V> indexBy(Iterator<V> groupies, Function<V,K> indexer)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typegroupies - elements to be indexedindexer - the function used to index elementspublic static <K,V,M extends Map<K,V>> Map<K,V> indexBy(V[] groupies, Function<V,K> indexer, Supplier<M> mapProvider)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typeM - the map typegroupies - elements to be indexedindexer - the function used to index elementsmapProvider - a supplier used to create the resulting mappublic static <K,V> Map<K,V> indexBy(V[] groupies, Function<V,K> indexer)
indexBy([1,2,3,4], id) -> {1:1, 2:2, 3:3, 4:4}K - the key typeV - the value typegroupies - elements to be indexedindexer - the function used to index elementsCopyright © 2017. All rights reserved.