當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。