本文整理汇总了Java中io.reactivex.functions.Consumer.accept方法的典型用法代码示例。如果您正苦于以下问题:Java Consumer.accept方法的具体用法?Java Consumer.accept怎么用?Java Consumer.accept使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.reactivex.functions.Consumer
的用法示例。
在下文中一共展示了Consumer.accept方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
@Override
public void accept(T t) throws Exception {
Consumer<T> orig = ref.get();
if(orig != null){
orig.accept(t);
}
}
示例2: applyActions
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
private void applyActions(final List<Consumer<ViewPropertyAnimatorCompat>> actions, final ViewPropertyAnimatorCompat animator) {
for (final Consumer<ViewPropertyAnimatorCompat> action : actions) {
try {
action.accept(animator);
} catch (Exception e) {
e.printStackTrace();
}
}
}
示例3: wrapQueueConsumer
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
protected static <T> Consumer<T> wrapQueueConsumer(Consumer<T> action, IRxBusQueue isResumedProvider)
{
return new Consumer<T>()
{
@Override
public void accept(T t) throws Exception
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
action.accept(t);
}
};
}
示例4: wrapQueueAction
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
public static <T> Consumer<T> wrapQueueAction(Consumer<T> action, IRxBusQueue isResumedProvider)
{
return new Consumer<T>()
{
@Override
public void accept(T t) throws Exception
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
action.accept(t);
}
};
}
示例5: wrapQueueAction
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
public static <T> Consumer<T> wrapQueueAction(Consumer<T> consumer, IRxBusQueue isResumedProvider)
{
return new Consumer<T>()
{
@Override
public void accept(T t) throws Exception
{
if (RxUtil.safetyQueueCheck(t, isResumedProvider))
consumer.accept(t);
}
};
}
示例6: ifPresent
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
@Nonnull
public RxOptional<T> ifPresent(@Nonnull Consumer<T> consumer) {
if (value != null) {
requireNonNull(consumer);
try {
consumer.accept(value);
} catch (Exception e) {
e.printStackTrace();
}
}
return this;
}
示例7: invoke
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
/**
* invoke a {@link Consumer} or throw a {@link RuntimeException}
*
* @param consumer the {@link Consumer} to invoke
* @param parameter the parameter passed
* @param <T> the type of the parameter
*/
static <T> void invoke(Consumer<T> consumer, T parameter) {
try {
consumer.accept(parameter);
} catch (Exception e) {
throw new RuntimeExceptionConverter().apply(e);
}
}
示例8: doIfViewNotNull
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
protected void doIfViewNotNull(final Consumer<T> whenViewNotNull) throws Exception {
final T view = getNullableView();
if (view != null) {
whenViewNotNull.accept(view);
}
}
示例9: invokeGuard
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
private T invokeGuard(Consumer<T> action) throws Exception {
action.accept(item);
return item;
}
示例10: preapply
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
private static <T> Action preapply(Consumer<T> consumer, T instance) {
return () -> consumer.accept(instance);
}
示例11: emitUpdate
import io.reactivex.functions.Consumer; //导入方法依赖的package包/类
private void emitUpdate(K key, Consumer<Processor<V, V>> updater, Action missHandler, boolean disconnect)
{
Processor<V, V> subject = null;
if (disconnect) {
_writeLock.lock();
}
else {
_readLock.lock();
}
try {
// if we have a subject, we will emit the new value on the subject
if (_weakSources.containsKey(key)) {
WeakReference<Processor<V, V>> weakSource = _weakSources.get(key);
subject = weakSource.get();
}
if (disconnect) {
_weakSources.remove(key);
_weakCache.remove(key);
_cache.remove(key);
}
}
finally {
if (disconnect) {
_writeLock.unlock();
}
else {
_readLock.unlock();
}
}
try {
if (subject != null) {
updater.accept(subject);
}
else {
missHandler.run();
}
}
catch (Exception e) {
throw new RuntimeException(e);
}
}