本文整理汇总了Java中rx.functions.Func2.call方法的典型用法代码示例。如果您正苦于以下问题:Java Func2.call方法的具体用法?Java Func2.call怎么用?Java Func2.call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rx.functions.Func2
的用法示例。
在下文中一共展示了Func2.call方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: elementsEqual
import rx.functions.Func2; //导入方法依赖的package包/类
public static <T> boolean elementsEqual(List<T> list1, List<T> list2, Func2<T, T, Boolean> comparator) {
if (list1 == null || list2 == null) {
return false;
}
if (list1.size() != list2.size()) {
return false;
}
for (int i = 0; i < list1.size(); i++) {
if (!comparator.call(list1.get(i), list2.get(i))) {
return false;
}
}
return true;
}
示例2: indexOf
import rx.functions.Func2; //导入方法依赖的package包/类
/**
* Returns the index of the first element in `xs` that equals `x`, or `-1` if `x` is not found in `xs`. Equality is determined
* by the given function.
*/
public static <T> int indexOf(final @NonNull List<T> xs, final @NonNull T y, final @NonNull Func2<T, T, Boolean> equality) {
for (int idx = 0; idx < xs.size(); idx++) {
if (equality.call(xs.get(idx), y)) {
return idx;
}
}
return -1;
}
示例3: createChannel
import rx.functions.Func2; //导入方法依赖的package包/类
private synchronized ChannelWrapper createChannel(ChannelType type, Func2<Integer, Channel, ChannelImpl> channelFunction) throws IOException {
Channel innerChannel = getOrCreateConnection(type).createChannel();
ConnectionInfo info = conToChannel.get(type);
ChannelImpl channel = channelFunction.call(innerChannel.hashCode(), innerChannel);
info.channels.add(channel);
log.infoWithParams("Successfully created "+type+" channel.",
"channel", channel,
"properties", info.clientProperties);
return channel;
}
示例4: flip
import rx.functions.Func2; //导入方法依赖的package包/类
/**
* @param func
* @return
*/
public static <T0, T1, R> Func2<T1, T0, R> flip(final Func2<? super T0, ? super T1, ? extends R> func) {
return new Func2<T1, T0, R>() {
@Override
public R call(T1 t1, T0 t0) {
return func.call(t0, t1);
}
};
}
示例5: writeToResource
import rx.functions.Func2; //导入方法依赖的package包/类
private static <T, Resource> Func1<List<T>, Observable<Resource>> writeToResource(
final Func2<Observable<T>, Resource, Observable<Resource>> writer,
final Func0<Resource> resourceFactory) {
return a -> {
Resource resource = resourceFactory.call();
return writer.call(Observable.from(a), resource);
};
}