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