本文整理了Java中cyclops.reactive.ReactiveSeq.prepend
方法的一些代码示例,展示了ReactiveSeq.prepend
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.prepend
方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:prepend
暂无
代码示例来源:origin: aol/cyclops
@Override
default ImmutableSet<T> prepend(T value) {
return unitStream(stream().prepend(value));
}
代码示例来源:origin: aol/cyclops
@Test
public void prependAppend(){
assertThat(of(1)
.prependStream(Stream.of(2)).append(3).prepend(4).appendAll(5,6)
.prependAll(7,8)
.insertAt(4,9).deleteBetween(1,2)
.insertStreamAt(5,Stream.of(11,12)).stream().count(),equalTo(10L));
}
@Test
代码示例来源:origin: aol/cyclops
@Override
public IntMap<T> prepend(T value) {
return unitStream(stream().prepend(value));
}
代码示例来源:origin: aol/cyclops
/**
* Prepend given values to the skip of the Stream
* <pre>
* {@code
* List<String> result = Streamable.of(1,2,3)
* .prependAll(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
* }
* </pre>
* @param t value to prependAll
* @return Streamable with values prepended
*/
default Streamable<T> prepend(final T t) {
return Streamable.fromStream(this.stream().prepend(t));
}
代码示例来源:origin: aol/cyclops
@Override
default ImmutableSortedSet<T> prepend(T value) {
return unitStream(stream().prepend(value),comparator());
}
代码示例来源:origin: aol/cyclops
default <R> Validated<E,Seq<R>> traverse(Iterable<Validated<E,T>> seq,Function<? super T,? extends R> fn){
return ReactiveSeq.fromIterable(seq)
.prepend(this)
.foldLeft(Validated.<E,Seq<R>>valid(Seq.<R>empty()),(a, b)-> a.combine(Semigroups.<R>seqConcat(),b.map(v->Seq.of(fn.apply(v)))));
}
代码示例来源:origin: aol/cyclops
default Validated<E,Seq<T>> sequence(Iterable<Validated<E,T>> seq){
return ReactiveSeq.fromIterable(seq)
.prepend(this)
.foldLeft(Validated.<E,Seq<T>>valid(Seq.<T>empty()),(a, b)-> a.combine(Semigroups.<T>seqConcat(),b.map(Seq::of)));
}
代码示例来源:origin: aol/cyclops
/**
* <pre>
* {@code
* ReactiveSeq.of(1,2,3).combinations()
*
* //ReactiveSeq[ReactiveSeq[],ReactiveSeq[1],ReactiveSeq[2],ReactiveSeq[3].ReactiveSeq[1,2],ReactiveSeq[1,3],ReactiveSeq[2,3]
* ,ReactiveSeq[1,2,3]]
* }
* </pre>
*
*
* @return All combinations of the elements in this stream
*/
@Override
default ReactiveSeq<ReactiveSeq<T>> combinations() {
Object[] a = toArray();
return range(1, a.length+1).map(size->Streams.<T>combinations(size,a))
.flatMap(s -> s)
.prepend(ReactiveSeq.<T>empty());
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableSet<T> prepend(T value) {
return unitStream(stream().prepend(value));
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
public IntMap<T> prepend(T value) {
return unitStream(stream().prepend(value));
}
代码示例来源:origin: com.oath.cyclops/cyclops-futurestream
@Override
public FutureStream<U> prepend(final U value) {
return fromStream(stream().prepend(value));
}
代码示例来源:origin: com.oath.cyclops/cyclops
/**
* Prepend given values to the skip of the Stream
* <pre>
* {@code
* List<String> result = Streamable.of(1,2,3)
* .prependAll(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
assertThat(result,equalTo(Arrays.asList("100!!","200!!","300!!","1!!","2!!","3!!")));
* }
* </pre>
* @param t value to prependAll
* @return Streamable with values prepended
*/
default Streamable<T> prepend(final T t) {
return Streamable.fromStream(this.stream().prepend(t));
}
代码示例来源:origin: com.oath.cyclops/cyclops
@Override
default ImmutableSortedSet<T> prepend(T value) {
return unitStream(stream().prepend(value),comparator());
}
代码示例来源:origin: com.oath.cyclops/cyclops
default <R> Validated<E,Seq<R>> traverse(Iterable<Validated<E,T>> seq,Function<? super T,? extends R> fn){
return ReactiveSeq.fromIterable(seq)
.prepend(this)
.foldLeft(Validated.<E,Seq<R>>valid(Seq.<R>empty()),(a, b)-> a.combine(Semigroups.<R>seqConcat(),b.map(v->Seq.of(fn.apply(v)))));
}
代码示例来源:origin: com.oath.cyclops/cyclops
default Validated<E,Seq<T>> sequence(Iterable<Validated<E,T>> seq){
return ReactiveSeq.fromIterable(seq)
.prepend(this)
.foldLeft(Validated.<E,Seq<T>>valid(Seq.<T>empty()),(a, b)-> a.combine(Semigroups.<T>seqConcat(),b.map(Seq::of)));
}
代码示例来源:origin: com.oath.cyclops/cyclops
/**
* <pre>
* {@code
* ReactiveSeq.of(1,2,3).combinations()
*
* //ReactiveSeq[ReactiveSeq[],ReactiveSeq[1],ReactiveSeq[2],ReactiveSeq[3].ReactiveSeq[1,2],ReactiveSeq[1,3],ReactiveSeq[2,3]
* ,ReactiveSeq[1,2,3]]
* }
* </pre>
*
*
* @return All combinations of the elements in this stream
*/
@Override
default ReactiveSeq<ReactiveSeq<T>> combinations() {
Object[] a = toArray();
return range(1, a.length+1).map(size->Streams.<T>combinations(size,a))
.flatMap(s -> s)
.prepend(ReactiveSeq.<T>empty());
}
内容来源于网络,如有侵权,请联系作者删除!