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