cyclops.reactive.ReactiveSeq.fill()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(114)

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

ReactiveSeq.fill介绍

[英]Construct a Stream consisting of a single value repeatedly infinitely (use take / drop etc to switch to a finite Stream)
[中]构造一个由单个值无限重复组成的流(使用take/drop等切换到有限流)

代码示例

代码示例来源:origin: aol/cyclops

static <T> LazySeq<T> fill(T t){
  return LazySeq.fromStream(ReactiveSeq.fill(t));
}
static <T> LazySeq<T> fill(long limit, T t){

代码示例来源:origin: aol/cyclops

static <T> IntMap<T> fill(T t, int max){
  return IntMap.fromStream(ReactiveSeq.fill(t).take(max));
}
static <U, T> IntMap<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: aol/cyclops

static <T> LazySeq<T> fill(long limit, T t){
  return LazySeq.fromStream(ReactiveSeq.fill(t).take(limit));
}
static <U, T> LazySeq<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: aol/cyclops

public static <T> Vector<T> fill(T t, int max){
  return Vector.fromStream(ReactiveSeq.fill(t).take(max));
}

代码示例来源:origin: aol/cyclops

static <T> Seq<T> fill(T t, int max){
  return Seq.fromStream(ReactiveSeq.fill(t).take(max));
}
static <U, T> Seq<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: aol/cyclops

@Override
public ReactiveSeq<T> cycle() {
  Spliterator<T> t = copy();
  return  ReactiveSeq.fill(1)
      .flatMap(i->createSeq(CopyableSpliterator.copy(t),reversible));
}

代码示例来源:origin: aol/cyclops

@Override
public ReactiveSeq<T> cycle(long times) {
  return ReactiveSeq.fill(1)
      .limit(times)
      .flatMap(i -> createSeq(copy(), reversible));
}
public <R> R fold(Function<? super ReactiveSeq<T>,? extends R> sync, Function<? super ReactiveSeq<T>,? extends R> reactiveStreams,

代码示例来源:origin: aol/cyclops

@Test
public void requestTwo(){
  new SpliteratorToOperator<Integer>(ReactiveSeq.fill(10).limit(100).spliterator())
      .subscribe(values::add,errors::add,()->onComplete=true)
      .request(2l);
  assertThat(values.size(),equalTo(2));
}

代码示例来源:origin: aol/cyclops

@Test
public void testLimit(){
  assertThat(ReactiveSeq.fill(1).limit(2).count(),equalTo(2l));
}

代码示例来源:origin: aol/cyclops

@Test
public void requestOne(){
  Subscription sub = new FilterOperator<>(new SpliteratorToOperator<Integer>(ReactiveSeq.fill(10).limit(100).spliterator()),
      i->true)
      .subscribe(values::add,errors::add,()->onComplete=true);
  sub.request(1l);
  assertThat(values.size(),equalTo(1));
  assertFalse(onComplete);
  sub.cancel();
  sub.request(1l);
  assertThat(values.size(),equalTo(1));
  assertFalse(onComplete);
}
@Test

代码示例来源:origin: aol/cyclops

@Test
public void fillReplay(){
  ReactiveSeq<Integer> seq = ReactiveSeq.fill(1);
  ReactiveSeq<Integer> seq1 = seq.take(100).map(i->i*2);
  seq.take(100).forEach(System.out::println);
  seq1.forEach(System.err::println);
}

代码示例来源:origin: com.oath.cyclops/cyclops

static <T> LazySeq<T> fill(T t){
  return LazySeq.fromStream(ReactiveSeq.fill(t));
}
static <T> LazySeq<T> fill(long limit, T t){

代码示例来源:origin: com.oath.cyclops/cyclops

static <T> Seq<T> fill(T t, int max){
  return Seq.fromStream(ReactiveSeq.fill(t).take(max));
}
static <U, T> Seq<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: com.oath.cyclops/cyclops

static <T> IntMap<T> fill(T t, int max){
  return IntMap.fromStream(ReactiveSeq.fill(t).take(max));
}
static <U, T> IntMap<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: com.oath.cyclops/cyclops

public static <T> Vector<T> fill(T t, int max){
  return Vector.fromStream(ReactiveSeq.fill(t).take(max));
}

代码示例来源:origin: com.oath.cyclops/cyclops

static <T> LazySeq<T> fill(long limit, T t){
  return LazySeq.fromStream(ReactiveSeq.fill(t).take(limit));
}
static <U, T> LazySeq<T> unfold(final U seed, final Function<? super U, Option<Tuple2<T, U>>> unfolder) {

代码示例来源:origin: com.oath.cyclops/cyclops

@Override
public ReactiveSeq<T> cycle() {
  Spliterator<T> t = copy();
  return  ReactiveSeq.fill(1)
      .flatMap(i->createSeq(CopyableSpliterator.copy(t),reversible));
}

代码示例来源:origin: com.oath.cyclops/cyclops

@Override
public ReactiveSeq<T> cycle(long times) {
  return ReactiveSeq.fill(1)
      .limit(times)
      .flatMap(i -> createSeq(copy(), reversible));
}
public <R> R fold(Function<? super ReactiveSeq<T>,? extends R> sync, Function<? super ReactiveSeq<T>,? extends R> reactiveStreams,

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法