本文整理匯總了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();
}