本文整理了Java中cyclops.reactive.ReactiveSeq.grouped
方法的一些代码示例,展示了ReactiveSeq.grouped
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.grouped
方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:grouped
[英]Batch elements by size into a List
ReactiveSeq.of(1,2,3,4,5,6)
[中]按大小将元素批处理到列表中
ReactiveSeq.of(1,2,3,4,5,6)
代码示例来源:origin: aol/micro-server
private Map<String, String> buildProperties(Microserver microserver) {
Map<String, String> properties = ReactiveSeq.of(microserver.properties())
.grouped(2)
.toMap(prop -> prop.getOrElse(0,null), prop -> prop.getOrElse(1,null));
return properties;
}
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize3(){
System.out.println(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).size(),is(2));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize3(){
System.out.println(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).size(),is(2));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize(){
System.out.println(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).size(),is(2));
}
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize(){
System.out.println(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).size(),is(2));
}
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize(){
System.out.println(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).size(),is(2));
}
代码示例来源:origin: aol/cyclops
@Test
public void groupedEmpty0() throws Exception {
empty.grouped(0).toList();
assertThat(Spouts.of(1,2,3).grouped(0).toList(),equalTo(Arrays.asList(Vector.of(1,2,3))));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize3(){
System.out.println(of(1,2,3,4,5,6).grouped(3).to(Streamable::fromStream).collect(Collectors.toList()));
assertThat(of(1,2,3,4,5,6).grouped(3).to(Streamable::fromStream).collect(Collectors.toList()).size(),is(2));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeInternalSize(){
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).get(0).size(),is(3));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeInternalSize(){
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).get(0).size(),is(3));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeInternalSize(){
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).get(0).size(),is(3));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeInternalSize(){
assertThat(of(1,2,3,4,5,6).grouped(3).collect(Collectors.toList()).get(0).size(),is(3));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeSetEmpty(){
assertThat(this.<Integer>of().grouped(3,()->TreeSet.empty()).toList().size(),is(0));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void batchBySizeSetEmpty(){
assertThat(this.<Integer>of().grouped(3,()->TreeSet.empty()).toList().size(),is(0));
}
@Test
代码示例来源:origin: aol/cyclops
@Test
public void groupedInfinite() {
ReactiveSeq<Integer> infinite = ReactiveSeq.iterate(1, i->i+1);
final ReactiveSeq<Vector<Integer>> grouped = infinite.grouped(3);
assertThat(grouped.elementAt(0).toOptional().get(),equalTo(Vector.of(1,2,3)));
}
代码示例来源:origin: aol/cyclops
@Test
public void groupedInfinite() {
ReactiveSeq<Integer> infinite = Spouts.iterate(1, i->i+1);
final ReactiveSeq<Vector<Integer>> grouped = infinite.grouped(3);
assertThat(grouped.elementAt(0).toOptional().get(),equalTo(Vector.of(1,2,3)));
}
代码示例来源:origin: aol/cyclops
@Test
public void groupedInfinite() {
ReactiveSeq<Integer> infinite = ReactiveSeq.iterate(1, i->i+1);
final ReactiveSeq<Vector<Integer>> grouped = infinite.grouped(3);
assertThat(grouped.elementAt(0).toOptional().get(),equalTo(Vector.of(1,2,3)));
}
代码示例来源:origin: aol/cyclops
@Test
public void groupedEqualSize() throws Exception {
final Streamable<Integer> fixed = Streamable.fromStream(of(5, 7, 9));
assertThat(fixed.stream().grouped(3).elementAt(0).toOptional().get(),equalTo(Vector.of(5,7,9)));
assertThat(fixed.stream().grouped(3).count(),equalTo(1l));
}
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize() {
iterate("", last -> "next")
.limit(100)
.grouped(10)
.onePer(1, TimeUnit.MICROSECONDS)
.peek(batch -> System.out.println("batched : " + batch))
.concatMap(Function.identity())
.peek(individual -> System.out.println("Flattened : "
+ individual))
.forEach(a->{});
}
代码示例来源:origin: aol/cyclops
@Test
public void batchBySize() {
iterate("", last -> "next")
.limit(100)
.grouped(10)
.onePer(1, TimeUnit.MICROSECONDS)
.peek(batch -> System.out.println("batched : " + batch))
.concatMap(i->i)
.peek(individual -> System.out.println("Flattened : "
+ individual))
.forEach(a->{});
}
内容来源于网络,如有侵权,请联系作者删除!