io.reactivex.common.Notification.createOnNext()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中io.reactivex.common.Notification.createOnNext()方法的一些代码示例,展示了Notification.createOnNext()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Notification.createOnNext()方法的具体详情如下:
包路径:io.reactivex.common.Notification
类名称:Notification
方法名:createOnNext

Notification.createOnNext介绍

[英]Constructs an onNext notification containing the given value.
[中]构造包含给定值的onNext通知。

代码示例

代码示例来源:origin: akarnokd/RxJava3-preview

@Override
public void onNext(T t) {
  produced++;
  actual.onNext(Notification.createOnNext(t));
}

代码示例来源:origin: com.github.akarnokd.rxjava3/rxjava3-observable

@Override
public void onNext(T t) {
  actual.onNext(Notification.createOnNext(t));
}

代码示例来源:origin: com.github.akarnokd/rxjava3-common

@Override
  public void accept(T v) throws Exception {
    onNotification.accept(Notification.createOnNext(v));
  }
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Override
  public void accept(T v) throws Exception {
    onNotification.accept(Notification.createOnNext(v));
  }
}

代码示例来源:origin: com.github.akarnokd.rxjava3/rxjava3-common

@Override
  public void accept(T v) throws Exception {
    onNotification.accept(Notification.createOnNext(v));
  }
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Override
public void onNext(T t) {
  actual.onNext(Notification.createOnNext(t));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test(expected = NullPointerException.class)
public void testOnNextIntegerNotificationDoesNotEqualNullNotification() {
  final Notification<Integer> integerNotification = Notification.createOnNext(1);
  final Notification<Integer> nullNotification = Notification.createOnNext(null);
  Assert.assertFalse(integerNotification.equals(nullNotification));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test(expected = NullPointerException.class)
public void testOnNextNullNotificationDoesNotEqualIntegerNotification() {
  final Notification<Integer> integerNotification = Notification.createOnNext(1);
  final Notification<Integer> nullNotification = Notification.createOnNext(null);
  Assert.assertFalse(nullNotification.equals(integerNotification));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void testOnNextIntegerNotificationsWhenNotEqual() {
  final Notification<Integer> integerNotification = Notification.createOnNext(1);
  final Notification<Integer> integerNotification2 = Notification.createOnNext(2);
  Assert.assertFalse(integerNotification.equals(integerNotification2));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void testOnNextIntegerNotificationsWhenEqual() {
  final Notification<Integer> integerNotification = Notification.createOnNext(1);
  final Notification<Integer> integerNotification2 = Notification.createOnNext(1);
  Assert.assertTrue(integerNotification.equals(integerNotification2));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void hashCodeIsTheInner() {
  Notification<Integer> n1 = Notification.createOnNext(1337);
  assertEquals(Integer.valueOf(1337).hashCode(), n1.hashCode());
  assertEquals(0, Notification.createOnComplete().hashCode());
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void nextObserverOnNext() throws Exception {
  NextObserver<Integer> no = new NextObserver<Integer>();
  no.setWaiting();
  no.onNext(Notification.createOnNext(1));
  no.setWaiting();
  no.onNext(Notification.createOnNext(1));
  assertEquals(1, no.takeNext().getValue().intValue());
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void nextObserverOnNext() throws Exception {
  NextSubscriber<Integer> no = new NextSubscriber<Integer>();
  no.setWaiting();
  no.onNext(Notification.createOnNext(1));
  no.setWaiting();
  no.onNext(Notification.createOnNext(1));
  assertEquals(1, no.takeNext().getValue().intValue());
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Override
  protected void subscribeActual(Subscriber<? super Object> observer) {
    observer.onSubscribe(new BooleanSubscription());
    observer.onNext(Notification.createOnComplete());
    observer.onNext(Notification.createOnNext(1));
    observer.onNext(Notification.createOnError(new TestException("First")));
    observer.onError(new TestException("Second"));
  }
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
  public void nextObserverOnCompleteOnNext() throws Exception {
    NextObserver<Integer> no = new NextObserver<Integer>();

    no.setWaiting();
    no.onNext(Notification.<Integer>createOnComplete());

    no.setWaiting();
    no.onNext(Notification.createOnNext(1));

    assertTrue(no.takeNext().isOnComplete());
  }
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
  public void toStringPattern() {
    assertEquals("OnNextNotification[1]", Notification.createOnNext(1).toString());
    assertEquals("OnErrorNotification[io.reactivex.common.exceptions.TestException]", Notification.createOnError(new TestException()).toString());
    assertEquals("OnCompleteNotification", Notification.createOnComplete().toString());
  }
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void notEqualsToObject() {
  Notification<Integer> n1 = Notification.createOnNext(0);
  assertFalse(n1.equals(0));
  Notification<Integer> n2 = Notification.createOnError(new TestException());
  assertFalse(n2.equals(0));
  Notification<Integer> n3 = Notification.createOnComplete();
  assertFalse(n3.equals(0));
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Test
public void nextObserverOnCompleteOnNext() throws Exception {
  NextSubscriber<Integer> no = new NextSubscriber<Integer>();
  no.setWaiting();
  no.onNext(Notification.<Integer>createOnComplete());
  no.setWaiting();
  no.onNext(Notification.createOnNext(1));
  assertTrue(no.takeNext().isOnComplete());
}

代码示例来源:origin: akarnokd/RxJava3-preview

@Override
  protected void subscribeActual(Observer<? super Object> observer) {
    observer.onSubscribe(Disposables.empty());
    observer.onNext(Notification.createOnComplete());
    observer.onNext(Notification.createOnNext(1));
    observer.onNext(Notification.createOnError(new TestException("First")));
    observer.onError(new TestException("Second"));
  }
}

相关文章