io.reactivex.subjects.Subject.onNext()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.6k)|赞(0)|评价(0)|浏览(121)

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

Subject.onNext介绍

暂无

代码示例

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onComplete() {
  DisposableHelper.replace(upstream, null);
  active = false;
  signaller.onNext(0);
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    s.onNext(1);
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
public void onError(Throwable e) {
  DisposableHelper.replace(upstream, null);
  active = false;
  signaller.onNext(e);
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    s.onNext(1);
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    s.onNext(1);
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    s.onNext(2);
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    s.onNext(1);
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    try {
      Thread.sleep(500);
    } catch (InterruptedException e) {
      // ignore
    }
    o.onNext(value);
  }
}.start();

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void run() {
    ps1.onNext(1);
    ps1.onComplete();
  }
};

代码示例来源:origin: ReactiveX/RxJava

/**
 * Emit the given values and complete the Subject.
 * @param <T> the value type
 * @param p the target subject
 * @param values the values to emit
 */
public static <T> void emit(Subject<T> p, T... values) {
  for (T v : values) {
    p.onNext(v);
  }
  p.onComplete();
}

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Override
  public void onNext(Integer t) {
    super.onNext(t);
    if (t == 1) {
      ps.onNext(2);
      ps.onComplete();
    }
  }
};

代码示例来源:origin: ReactiveX/RxJava

@Test
public void testMostRecent() {
  Subject<String> s = PublishSubject.create();
  Iterator<String> it = mostRecent(s, "default").iterator();
  assertTrue(it.hasNext());
  assertEquals("default", it.next());
  assertEquals("default", it.next());
  s.onNext("one");
  assertTrue(it.hasNext());
  assertEquals("one", it.next());
  assertEquals("one", it.next());
  s.onNext("two");
  assertTrue(it.hasNext());
  assertEquals("two", it.next());
  assertEquals("two", it.next());
  s.onComplete();
  assertFalse(it.hasNext());
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void periodicWindowCompletionRestartTimerBoundedSomeData() {
  TestScheduler scheduler = new TestScheduler();
  Subject<Integer> ps = PublishSubject.<Integer>create();
  TestObserver<Observable<Integer>> to = ps.window(5, TimeUnit.MILLISECONDS, scheduler, 2, true)
  .test();
  ps.onNext(1);
  ps.onNext(2);
  scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);
  to.assertValueCount(22)
  .assertNoErrors()
  .assertNotComplete();
}

代码示例来源:origin: ReactiveX/RxJava

@Test
public void onNextNull() {
  Subject<T> p = create();
  try {
    p.onNext(null);
    fail("No NullPointerException thrown");
  } catch (NullPointerException ex) {
    assertEquals("onNext called with null. Null values are generally not allowed in 2.x operators and sources.", ex.getMessage());
  }
  p.test().assertEmpty().cancel();
}

相关文章