本文整理了Java中org.eclipse.collections.api.block.function.Function.valueOf()
方法的一些代码示例,展示了Function.valueOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Function.valueOf()
方法的具体详情如下:
包路径:org.eclipse.collections.api.block.function.Function
类名称:Function
方法名:valueOf
暂无
代码示例来源:origin: eclipse/eclipse-collections
@Override
public V valueOf(T anObject)
{
V returnValue = this.function.valueOf(anObject);
if (returnValue == null)
{
return this.defaultValue;
}
return returnValue;
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public V valueOf(T object)
{
return object == null ? this.nullValue : this.function.valueOf(object);
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public T3 valueOf(T1 object)
{
return this.function2.valueOf(this.function1.valueOf(object));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public T value(T argument1, T argument2)
{
V first = this.function.valueOf(argument1);
V second = this.function.valueOf(argument2);
return first.compareTo(second) < 0 ? argument2 : argument1;
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <VV, R extends Collection<VV>> R collect(Function<? super V, ? extends VV> function, R target)
{
target.add(function.valueOf(this.value1));
return target;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public int computeHashCode(T object)
{
return this.function.valueOf(object).hashCode();
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <VV, R extends MutableMapIterable<VV, V>> R groupByUniqueKey(Function<? super V, ? extends VV> function, R target)
{
if (target.put(function.valueOf(this.value1), this.value1) != null)
{
throw new IllegalStateException("Key " + function.valueOf(this.value1) + " already exists in map!");
}
return target;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <V, R extends Collection<V>> R flatCollect(
Function<? super T, ? extends Iterable<V>> function, R target)
{
Iterate.addAllTo(function.valueOf(this.value), target);
return target;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public boolean booleanValueOf(T1 object)
{
return this.function2.booleanValueOf(this.function1.valueOf(object));
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public double doubleValueOf(T1 object)
{
return this.function2.doubleValueOf(this.function1.valueOf(object));
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public void value(T1 each, T3 constant)
{
this.delegate.value(this.function.valueOf(each), constant);
}
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public boolean accept(T each, P injectedValue)
{
return this.predicate.accept(this.function.valueOf(each), injectedValue);
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <VV> ImmutableBag<VV> collect(Function<? super V, ? extends VV> function)
{
return Bags.immutable.with(function.valueOf(this.value1));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <VV> ImmutableBag<VV> flatCollect(Function<? super V, ? extends Iterable<VV>> function)
{
return Bags.immutable.withAll(function.valueOf(this.value1));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <VV, R extends Collection<VV>> R collectIf(Predicate<? super V> predicate, Function<? super V, ? extends VV> function, R target)
{
if (predicate.accept(this.value1))
{
target.add(function.valueOf(this.value1));
}
return target;
}
代码示例来源:origin: neo4j/neo4j
@Override
public <P> Value getIfAbsentPutWith( long key, Function<? super P, ? extends Value> function, P parameter )
{
final Value existing = get( key );
if ( existing != null )
{
return existing;
}
final Value value = function.valueOf( parameter );
put( key, value );
return value;
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public void forEach(Procedure<? super V> procedure)
{
this.delegate.forEach(each -> Iterate.forEach(this.function.valueOf(each), procedure));
}
代码示例来源:origin: eclipse/eclipse-collections
@Override
public <V, R extends MutableMultimap<V, T>> R groupByEach(
Function<? super T, ? extends Iterable<V>> function,
R target)
{
this.forEachWithOccurrences((each, occurrences) -> {
Iterable<V> values = function.valueOf(each);
Iterate.forEach(values, value -> target.putAll(value, Collections.nCopies(occurrences, each)));
});
return target;
}
代码示例来源:origin: eclipse/eclipse-collections
public MutableObjectDoubleMap<V> value(MutableObjectDoubleMap<V> map, T each)
{
V groupKey = groupBy.valueOf(each);
double compensation = this.compensation.getIfAbsent(groupKey, 0.0d);
double adjustedValue = function.doubleValueOf(each) - compensation;
double nextSum = map.get(groupKey) + adjustedValue;
this.compensation.put(groupKey, nextSum - map.get(groupKey) - adjustedValue);
map.put(groupKey, nextSum);
return map;
}
};
代码示例来源:origin: neo4j/neo4j
@Test
void getIfAbsentPutWith()
{
@SuppressWarnings( {"Convert2Lambda", "Anonymous2MethodRef"} )
final Function<String, Value> function = spy( new Function<String, Value>()
{
@Override
public Value valueOf( String s )
{
return intValue( Integer.valueOf( s ) );
}
} );
assertEquals( intValue( 10 ), map.getIfAbsentPutWith( 0, function, "10" ) );
assertEquals( intValue( 10 ), map.getIfAbsentPutWith( 0, function, "10" ) );
assertEquals( intValue( 11 ), map.getIfAbsentPutWith( 1, function, "11" ) );
assertEquals( intValue( 11 ), map.getIfAbsentPutWith( 1, function, "11" ) );
assertEquals( intValue( 12 ), map.getIfAbsentPutWith( 2, function, "12" ) );
assertEquals( intValue( 12 ), map.getIfAbsentPutWith( 2, function, "12" ) );
verify( function ).valueOf( eq( "10" ) );
verify( function ).valueOf( eq( "11" ) );
verify( function ).valueOf( eq( "12" ) );
verifyNoMoreInteractions( function );
}
内容来源于网络,如有侵权,请联系作者删除!