本文整理了Java中fj.data.List.groupBy()
方法的一些代码示例,展示了List.groupBy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.groupBy()
方法的具体详情如下:
包路径:fj.data.List
类名称:List
方法名:groupBy
[英]Groups the elements of this list by a given keyFunction into a TreeMap. The ordering of the keys is determined by fj.Ord#hashOrd() (ie. Object#hasCode). This is not safe and therefore this method is deprecated.
[中]按给定的键函数将此列表的元素分组到树映射中。键的顺序由fj决定。Ord#hashOrd()(即Object#hasCode)。这是不安全的,因此不推荐使用此方法。
代码示例来源:origin: org.functionaljava/functionaljava
/**
* Groups the elements of this list by a given keyFunction into a {@link TreeMap}.
*
* @param keyFunction The function to select the keys for the map.
* @param keyOrd An order for the keys of the tree map.
* @return A TreeMap containing the keys with the accumulated list of matched elements.
*/
public final <B> TreeMap<B, List<A>> groupBy(final F<A, B> keyFunction, final Ord<B> keyOrd) {
return groupBy(keyFunction, identity(), keyOrd);
}
代码示例来源:origin: org.functionaljava/functionaljava
/**
* Groups the elements of this list by a given keyFunction into a {@link TreeMap}.
* The ordering of the keys is determined by {@link fj.Ord#hashOrd()} (ie. Object#hasCode).
* This is not safe and therefore this method is deprecated.
*
* @param keyFunction The function to select the keys for the map.
* @return A TreeMap containing the keys with the accumulated list of matched elements.
*
* @deprecated As of release 4.7, use {@link #groupBy(F, Ord)}
*/
@Deprecated
public final <B> TreeMap<B, List<A>> groupBy(final F<A, B> keyFunction) {
return groupBy(keyFunction, Ord.hashOrd());
}
代码示例来源:origin: org.functionaljava/functionaljava
/**
* Groups the elements of this list by a given keyFunction into a {@link TreeMap} and transforms
* the matching elements with the given valueFunction. The ordering of the keys is determined by
* the keyOrd parameter.
*
* @param keyFunction The function to select the keys for the map.
* @param valueFunction The function to apply on each matching value.
* @param keyOrd An order for the keys of the tree map.
* @return A TreeMap containing the keys with the accumulated list of matched and mapped elements.
*/
public final <B, C> TreeMap<B, List<C>> groupBy(
final F<A, B> keyFunction,
final F<A, C> valueFunction,
final Ord<B> keyOrd) {
return this.groupBy(keyFunction, valueFunction, List.nil(), List::cons, keyOrd);
}
代码示例来源:origin: org.functionaljava/functionaljava
/**
* Groups the elements of this list by a given keyFunction into a {@link TreeMap} and transforms
* the matching elements with the given valueFunction. The ordering of the keys is determined by
* {@link fj.Ord#hashOrd()} (ie. Object#hasCode).
* This is not safe and therefore this method is deprecated.
*
* @param keyFunction The function to select the keys for the map.
* @param valueFunction The function to apply on each matching value.
* @return A TreeMap containing the keys with the accumulated list of matched and mapped elements.
*
* @deprecated As of release 4.7, use {@link #groupBy(F, F, Ord)}
*/
@Deprecated
public final <B, C> TreeMap<B, List<C>> groupBy(
final F<A, B> keyFunction,
final F<A, C> valueFunction) {
return this.groupBy(keyFunction, valueFunction, Ord.hashOrd());
}
代码示例来源:origin: org.functionaljava/functionaljava
/**
* Groups the elements of this list by a given keyFunction into a {@link TreeMap} and transforms
* the matching elements with the given valueFunction. The ordering of the keys is determined by
* the keyOrd parameter.
*
* @param keyFunction The function to select the keys for the map.
* @param valueFunction The function to apply on each matching value.
* @param monoid A monoid, which defines the accumulator for the values and the zero value.
* @param keyOrd An order for the keys of the tree map.
* @return A TreeMap containing the keys with the accumulated list of matched and mapped elements.
*/
public final <B, C> TreeMap<B, C> groupBy(
final F<A, B> keyFunction,
final F<A, C> valueFunction,
final Monoid<C> monoid,
final Ord<B> keyOrd) {
return groupBy(keyFunction, valueFunction, monoid.zero(),
uncurryF2(monoid.sum()), keyOrd);
}
代码示例来源:origin: it.unibz.inf.ontop/ontop-optimization
TreeMap<Variable, Set<Variable>> commonMap = renamingPairs.groupBy(P2.<Variable, Variable>__1(),
P2.<Variable, Variable>__2()).
内容来源于网络,如有侵权,请联系作者删除!