本文整理汇总了Java中java.util.function.Function.identity方法的典型用法代码示例。如果您正苦于以下问题:Java Function.identity方法的具体用法?Java Function.identity怎么用?Java Function.identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.function.Function
的用法示例。
在下文中一共展示了Function.identity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTranslationFromCanonical
import java.util.function.Function; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Function<BigDecimalAmount, BigDecimalAmount> getTranslationFromCanonical() {
Function<BigDecimalAmount, BigDecimalAmount> result = Function.identity();
for (UnitCount unitCount : unitCounter.getBaseUnits()) {
BaseUnit unit = unitCount.getUnit();
int count = unitCount.getCount();
if (count > 0) {
for (int i = 0; i < count; i++) {
result = result.andThen(unit.getTranslationFromCanonical());
}
} else if (count < 0) {
for (int i = 0; i > count; i--) {
result = result.andThen(unit.getTranslationToCanonical());
}
}
}
return result;
}
示例2: finisher
import java.util.function.Function; //导入方法依赖的package包/类
@Override
public Function<Component, Component> finisher() {
return Function.identity();
}
示例3: toGroup
import java.util.function.Function; //导入方法依赖的package包/类
public static <T extends Unit> Collector<T, Group<T>, Group<T>> toGroup() {
return new Collector<T, Group<T>, Group<T>>(){
@Override
public Supplier<Group<T>> supplier() {
return (Supplier<Group<T>>) Group::new;
}
@Override
public BiConsumer<Group<T>, T> accumulator() {
return (group, value) -> group.add(value);
}
@Override
public BinaryOperator<Group<T>> combiner() {
return (left, right) -> { left.addAll(right); return left; };
}
@Override
public Function<Group<T>, Group<T>> finisher() {
return Function.identity();
}
@Override
public Set<Characteristics> characteristics() {
return Collections.singleton(Characteristics.IDENTITY_FINISH);
}
};
}
示例4: stringSetting
import java.util.function.Function; //导入方法依赖的package包/类
public static Setting<String> stringSetting(String key, String value) {
Setting<String> setting = new Setting<>();
setting.key = key;
setting.defaultValue = value;
setting.parse = Function.identity();
return setting;
}
示例5: tryToGetBean
import java.util.function.Function; //导入方法依赖的package包/类
private Optional<Object> tryToGetBean(ApplicationContext applicationContext, DoubleDefinition doubleDefinition) {
final Function<String, String> beanNameResolver = isFactoryBean(doubleDefinition.getDoubleClass())
? FactoryBeanRecognizer::getFactoryBeanName
: Function.identity();
return Stream
.concat(
Stream.of(doubleDefinition.getName()),
doubleDefinition.getAliases().stream())
.map(beanNameResolver)
.map(nameOrAlias -> tryToGetBean(applicationContext, nameOrAlias))
.filter(Optional::isPresent)
.findFirst()
.orElse(Optional.empty());
}
示例6: ScalarUnit
import java.util.function.Function; //导入方法依赖的package包/类
private ScalarUnit() {
super(0, "", "", "", Function.identity(), Function.identity());
this.unitCounter = new UnitCounter();
}
示例7: relaxedMapCollector
import java.util.function.Function; //导入方法依赖的package包/类
private static <T,K,U,M extends Map<K,U>> Collector<T,M,M> relaxedMapCollector(
Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper,
Supplier<M> supplier){
return new Collector<T,M,M>(){
@Override
public Supplier<M> supplier(){
return supplier;
}
@Override
public BiConsumer<M,T> accumulator(){
return (map, element) -> {
K key = keyMapper.apply(element);
U value = valueMapper.apply(element);
map.put(key, value);
};
}
@Override
public BinaryOperator<M> combiner(){
return (map1, map2) -> {
map1.putAll(map2);
return map1;
};
}
@Override
public Function<M,M> finisher(){
return Function.identity();
}
@Override
public Set<Collector.Characteristics> characteristics(){
return Collections.unmodifiableSet(EnumSet.of(Collector.Characteristics.IDENTITY_FINISH));
}
};
}
示例8: InMemoryPlaintextSecret
import java.util.function.Function; //导入方法依赖的package包/类
public InMemoryPlaintextSecret(SecretsGroup secretsGroup, SecretIdentifier secretIdentifier) {
super(secretsGroup, secretIdentifier, Function.identity());
}
示例9: KiloGramUnit
import java.util.function.Function; //导入方法依赖的package包/类
private KiloGramUnit() {
super("Kg", "kilogram", "kilograms",
Function.identity(),
Function.identity());
}
示例10: AmpereUnit
import java.util.function.Function; //导入方法依赖的package包/类
private AmpereUnit() {
super("A", "ampere", "amperes",
Function.identity(),
Function.identity());
}
示例11: KelvinUnit
import java.util.function.Function; //导入方法依赖的package包/类
private KelvinUnit() {
super("K", "kelvin", "kelvins",
Function.identity(),
Function.identity());
}
示例12: selectNodes
import java.util.function.Function; //导入方法依赖的package包/类
@Override
public SelectMultipleFromNode<Node> selectNodes(String xPathQuery)
{
XPathExpression xPathExpression = this.context.compile(xPathQuery, this.namespaceContext);
return new SelectMultipleFromNodeImpl<>(baseNode, xPathExpression, Function.identity());
}
示例13: getTextParser
import java.util.function.Function; //导入方法依赖的package包/类
static public Function<String, String> getTextParser() {
return Function.identity();
}
示例14: finisher
import java.util.function.Function; //导入方法依赖的package包/类
@Override
public Function<AlbumSalesReport, AlbumSalesReport> finisher() {
return Function.identity();
}
开发者ID:jinyi233,项目名称:https-github.com-RichardWarburton-java-8-Lambdas-exercises,代码行数:5,代码来源:AlbumSalesCollector.java
示例15: finisher
import java.util.function.Function; //导入方法依赖的package包/类
@Override
public Function<A, A> finisher() {
return Function.identity();
}