当前位置: 首页>>代码示例>>Java>>正文


Java Function.identity方法代码示例

本文整理汇总了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;
}
 
开发者ID:pedro-borges,项目名称:Unified-World-Units,代码行数:25,代码来源:CompositeUnit.java

示例2: finisher

import java.util.function.Function; //导入方法依赖的package包/类
@Override
public Function<Component, Component> finisher() {
    return Function.identity();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:ComponentCollector.java

示例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);
	}
};
  }
 
开发者ID:OpenBW,项目名称:TSBW4J,代码行数:30,代码来源:Util.java

示例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;
}
 
开发者ID:mayabot,项目名称:mynlp,代码行数:8,代码来源:Setting.java

示例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());
}
 
开发者ID:pchudzik,项目名称:springmock,代码行数:16,代码来源:MockAttachingTestExecutionListener.java

示例6: ScalarUnit

import java.util.function.Function; //导入方法依赖的package包/类
private ScalarUnit() {
	super(0, "", "", "", Function.identity(), Function.identity());

	this.unitCounter = new UnitCounter();
}
 
开发者ID:pedro-borges,项目名称:Unified-World-Units,代码行数:6,代码来源:ScalarUnit.java

示例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));
		}

	};
}
 
开发者ID:hotpads,项目名称:datarouter,代码行数:40,代码来源:CollectorTool.java

示例8: InMemoryPlaintextSecret

import java.util.function.Function; //导入方法依赖的package包/类
public InMemoryPlaintextSecret(SecretsGroup secretsGroup, SecretIdentifier secretIdentifier) {
    super(secretsGroup, secretIdentifier, Function.identity());
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:4,代码来源:InMemoryPlaintextSecret.java

示例9: KiloGramUnit

import java.util.function.Function; //导入方法依赖的package包/类
private KiloGramUnit() {
	super("Kg", "kilogram", "kilograms",
			Function.identity(),
			Function.identity());
}
 
开发者ID:pedro-borges,项目名称:Unified-World-Units,代码行数:6,代码来源:KiloGramUnit.java

示例10: AmpereUnit

import java.util.function.Function; //导入方法依赖的package包/类
private AmpereUnit() {
	super("A", "ampere", "amperes",
			Function.identity(),
			Function.identity());
}
 
开发者ID:pedro-borges,项目名称:Unified-World-Units,代码行数:6,代码来源:AmpereUnit.java

示例11: KelvinUnit

import java.util.function.Function; //导入方法依赖的package包/类
private KelvinUnit() {
	super("K", "kelvin", "kelvins",
			Function.identity(),
			Function.identity());
}
 
开发者ID:pedro-borges,项目名称:Unified-World-Units,代码行数:6,代码来源:KelvinUnit.java

示例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());
}
 
开发者ID:fluentxml4j,项目名称:fluentxml4j,代码行数:7,代码来源:FromNodeImpl.java

示例13: getTextParser

import java.util.function.Function; //导入方法依赖的package包/类
static public Function<String, String> getTextParser() {
    return Function.identity();
}
 
开发者ID:wgslr,项目名称:OOP-ActParser,代码行数:4,代码来源:OptionParsers.java

示例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();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:5,代码来源:Collectors.java


注:本文中的java.util.function.Function.identity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。