Package org.nd4j.common.function
Class FunctionalUtils
- java.lang.Object
-
- org.nd4j.common.function.FunctionalUtils
-
public class FunctionalUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description FunctionalUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <K,V>
Map<K,Pair<List<V>,List<V>>>cogroup(List<Pair<K,V>> left, List<Pair<K,V>> right)
For each key in left and right, cogroup returns the list of values as a pair for each value present in left as well as right.static <K,V>
Map<K,List<V>>groupByKey(List<Pair<K,V>> listInput)
Group the input pairs by the key of each pair.static <K,V>
List<Pair<K,V>>mapToPair(Map<K,V> map)
Convert a map with a set of entries of type K for key and V for value in to a list ofPair
-
-
-
Method Detail
-
cogroup
public static <K,V> Map<K,Pair<List<V>,List<V>>> cogroup(List<Pair<K,V>> left, List<Pair<K,V>> right)
For each key in left and right, cogroup returns the list of values as a pair for each value present in left as well as right.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
left
- the left list of pairs to joinright
- the right list of pairs to join- Returns:
- a map of the list of values by key for each value in the left as well as the right with each element in the pair representing the values in left and right respectively.
-
groupByKey
public static <K,V> Map<K,List<V>> groupByKey(List<Pair<K,V>> listInput)
Group the input pairs by the key of each pair.- Type Parameters:
K
- the key typeV
- the value type- Parameters:
listInput
- the list of pairs to group- Returns:
- a map representing a grouping of the keys by the given input key type and list of values in the grouping.
-
-