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


Java Functions.identity方法代码示例

本文整理汇总了Java中rx.functions.Functions.identity方法的典型用法代码示例。如果您正苦于以下问题:Java Functions.identity方法的具体用法?Java Functions.identity怎么用?Java Functions.identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rx.functions.Functions的用法示例。


在下文中一共展示了Functions.identity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: EmptyEvictionPolicy

import rx.functions.Functions; //导入方法依赖的package包/类
/**
 * Creates an unbounded replay subject with the bounded-implementation for testing purposes.
 * <p>
 * This variant behaves like the regular unbounded {@code ReplaySubject} created via {@link #create()} but
 * uses the structures of the bounded-implementation. This is by no means intended for the replacement of
 * the original, array-backed and unbounded {@code ReplaySubject} due to the additional overhead of the
 * linked-list based internal buffer. The sole purpose is to allow testing and reasoning about the behavior
 * of the bounded implementations without the interference of the eviction policies.
 *
 * @param <T>
 *          the type of items observed and emitted by the Subject
 * @return the created subject
 */
/* public */ static <T> ReplaySubject<T> createUnbounded() {
    final BoundedState<T> state = new BoundedState<T>(
        new EmptyEvictionPolicy(),
        Functions.identity(),
        Functions.identity()
    );
    return createWithState(state, new DefaultOnAdd<T>(state));
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:22,代码来源:ReplaySubject.java

示例2: createWithSize

import rx.functions.Functions; //导入方法依赖的package包/类
/**
 * Creates a size-bounded replay subject.
 * <p>
 * In this setting, the {@code ReplaySubject} holds at most {@code size} items in its internal buffer and
 * discards the oldest item.
 * <p>
 * When observers subscribe to a terminated {@code ReplaySubject}, they are guaranteed to see at most
 * {@code size} {@code onNext} events followed by a termination event. 
 * <p>
 * If an observer subscribes while the {@code ReplaySubject} is active, it will observe all items in the
 * buffer at that point in time and each item observed afterwards, even if the buffer evicts items due to
 * the size constraint in the mean time. In other words, once an Observer subscribes, it will receive items
 * without gaps in the sequence.
 *
 * @param <T>
 *          the type of items observed and emitted by the Subject
 * @param size
 *          the maximum number of buffered items
 * @return the created subject
 */
public static <T> ReplaySubject<T> createWithSize(int size) {
    final BoundedState<T> state = new BoundedState<T>(
        new SizeEvictionPolicy(size),
        Functions.identity(),
        Functions.identity()
    );
    return createWithState(state, new DefaultOnAdd<T>(state));
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:29,代码来源:ReplaySubject.java


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