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

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

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

ReactiveSeq.unzip介绍

[英]Unzip a zipped Stream

unzip(ReactiveSeq.of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c")))

[中]解压压缩流

unzip(ReactiveSeq.of(new Tuple2(1, "a"), new Tuple2(2, "b"), new Tuple2(3, "c")))

代码示例

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

static <T, U> Tuple2<LazySeq<T>, LazySeq<U>> unzip(final LazySeq<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)->Tuple.tuple(fromStream(a),fromStream(b)));
}
static <T> LazySeq<T> generate(Supplier<T> s){

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

public static <T, U> Tuple2<Vector<T>, Vector<U>> unzip(final Vector<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)->Tuple.tuple(fromStream(a),fromStream(b)));
}
public static <T> Vector<T> generate(Supplier<T> s, int max){

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

public static <T, U> Tuple2<HashSet<T>, HashSet<U>> unzip(final HashSet<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)-> Tuple.tuple(fromStream(a),fromStream(b)));
}
public static <T> HashSet<T> generate(Supplier<T> s, int max){

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

static <T, U> Tuple2<IntMap<T>, IntMap<U>> unzip(final LazySeq<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)->Tuple.tuple(fromStream(a),fromStream(b)));
}
static <T> IntMap<T> generate(Supplier<T> s, int max){

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

static <T, U> Tuple2<Seq<T>, Seq<U>> unzip(final LazySeq<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)->Tuple.tuple(fromStream(a),fromStream(b)));
}
static <T> Seq<T> generate(Supplier<T> s, int max){

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

static <T, U> Tuple2<TreeSet<T>, TreeSet<U>> unzip(final TreeSet<Tuple2<T, U>> sequence) {
  return ReactiveSeq.unzip(sequence.stream()).transform((a, b)-> Tuple.tuple(fromStream(a,Comparators.naturalOrderIdentityComparator()),fromStream(b,Comparators.naturalOrderIdentityComparator())));
}
static <T> TreeSet<T> generate(Supplier<T> s, int max){

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzip() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertThat(u1._1().toList(), equalTo(asList(1, 2, 3)));
  assertThat(u1._2().toList(), equalTo(asList("a", "b", "c")));
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).to(Streamable::fromStream).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
  public void testUnzipWithLimits() {

    Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> ReactiveSeq.of(
        tuple(1, "a"),tuple(2, "b"),tuple(3, "c"));

    Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s
        .get());

    assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));

    assertTrue(u1._2().toList().containsAll(Arrays.asList("a", "b", "c")));

  }
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

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

@Test
public void testUnzipWithLimits() {
  Supplier<ReactiveSeq<Tuple2<Integer, String>>> s = () -> of(Tuple.tuple(1, "a"), Tuple.tuple(2, "b"), Tuple.tuple(3, "c"));
  Tuple2<ReactiveSeq<Integer>, ReactiveSeq<String>> u1 = ReactiveSeq.unzip(s.get());
  assertTrue(u1._1().limit(2).toList().containsAll(Arrays.asList(1, 2)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
}

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法