本文整理了Java中cyclops.reactive.ReactiveSeq.cycleWhile
方法的一些代码示例,展示了ReactiveSeq.cycleWhile
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.cycleWhile
方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:cycleWhile
[英]Repeat in a Stream while specified predicate holds
MutableInt count = MutableInt.of(0);
[中]当指定的谓词保持
MutableInt count = MutableInt.of(0);
代码示例来源:origin: aol/cyclops
/**
* Repeat in a Stream until specified predicate holds
*
* <pre>
* {@code
* MutableInt count =MutableInt.of(0);
* ReactiveSeq.of(1,2,2)
* .cycleUntil(next -> count.getValue()>6)
* .peek(i-> count.mutate(i->i+1))
* .collect(CyclopsCollectors.toList());
*
* //List[1,2,2,1,2,2,1]
* }
*
*
* @param predicate
* repeat while true
* @return Repeating Stream
*/
@Override
default ReactiveSeq<T> cycleUntil(Predicate<? super T> predicate){
return cycleWhile(predicate.negate());
}
代码示例来源:origin: aol/cyclops
@Override
default ImmutableList<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: aol/cyclops
@Override
default ImmutableSet<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: aol/cyclops
@Override
default ImmutableQueue<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: aol/cyclops
/**
* Repeat in a Stream while specified predicate holds
*
* <pre>
* {@code
*
* count =0;
assertThat(Streamable.of(1,2,2)
.cycleWhile(next -> count++<6)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(1,2,2,1,2,2)));
* }
* </pre>
*
* @param predicate
* repeat while true
* @return Repeating Stream
*/
@Override
default Streamable<T> cycleWhile(final Predicate<? super T> predicate) {
return Streamable.fromStream(this.stream().cycleWhile(predicate));
}
代码示例来源:origin: aol/cyclops
@Override
default ImmutableSortedSet<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate),comparator());
}
代码示例来源:origin: com.oath.cyclops/cyclops
/**
* Repeat in a Stream until specified predicate holds
*
* <pre>
* {@code
* MutableInt count =MutableInt.of(0);
* ReactiveSeq.of(1,2,2)
* .cycleUntil(next -> count.getValue()>6)
* .peek(i-> count.mutate(i->i+1))
* .collect(CyclopsCollectors.toList());
*
* //List[1,2,2,1,2,2,1]
* }
*
*
* @param predicate
* repeat while true
* @return Repeating Stream
*/
@Override
default ReactiveSeq<T> cycleUntil(Predicate<? super T> predicate){
return cycleWhile(predicate.negate());
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableQueue<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableSet<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableList<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate));
}
代码示例来源:origin: com.oath.cyclops/cyclops
/**
* Repeat in a Stream while specified predicate holds
*
* <pre>
* {@code
*
* count =0;
assertThat(Streamable.of(1,2,2)
.cycleWhile(next -> count++<6)
.collect(CyclopsCollectors.toList()),equalTo(Arrays.asList(1,2,2,1,2,2)));
* }
* </pre>
*
* @param predicate
* repeat while true
* @return Repeating Stream
*/
@Override
default Streamable<T> cycleWhile(final Predicate<? super T> predicate) {
return Streamable.fromStream(this.stream().cycleWhile(predicate));
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableSortedSet<T> cycleWhile(Predicate<? super T> predicate) {
return unitStream(stream().cycleWhile(predicate),comparator());
}
内容来源于网络,如有侵权,请联系作者删除!