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

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

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

ReactiveSeq.unzip3介绍

[英]Unzip a zipped Stream into 3

unzip3(ReactiveSeq.of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3,"c", 4l)))// ReactiveSeq[1,2,3], ReactiveSeq[a,b,c], ReactiveSeq[2l,3l,4l]

[中]将压缩后的流解压缩为3

unzip3(ReactiveSeq.of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3,"c", 4l)))// ReactiveSeq[1,2,3], ReactiveSeq[a,b,c], ReactiveSeq[2l,3l,4l]

代码示例

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

/**
 * Unzip a zipped Stream into 3
 * <pre>
 * {@code
 *    unzip3(Streamable.of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3,"c", 4l)))
 * }
 * // Streamable[1,2,3], Streamable[a,b,c], Streamable[2l,3l,4l]
 * </pre>
 */
public static <T1, T2, T3> Tuple3<Streamable<T1>, Streamable<T2>, Streamable<T3>> unzip3(final Streamable<Tuple3<T1, T2, T3>> sequence) {
  return ReactiveSeq.unzip3(sequence.stream())
           .map1(s -> fromStream(s))
           .map2(s -> fromStream(s))
           .map3(s -> fromStream(s));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().toList().containsAll(Arrays.asList(1, 2, 3)));
  assertTrue(u1._2().toList().containsAll(asList("a", "b", "c")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

@Test
public void testUnzip3WithLimits() {
  Supplier<ReactiveSeq<Tuple3<Integer, String, Long>>> s = () -> of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3, "c", 4l));
  Tuple3<ReactiveSeq<Integer>, ReactiveSeq<String>, ReactiveSeq<Long>> u1 = ReactiveSeq.unzip3(s.get());
  assertTrue(u1._1().limit(1).to(Streamable::fromStream).toList().containsAll(Arrays.asList(1)));
  assertTrue(u1._2().limit(2).to(Streamable::fromStream).toList().containsAll(asList("a", "b")));
  assertTrue(u1._3().toList().containsAll(asList(2l, 3l, 4l)));
}

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

/**
 * Unzip a zipped Stream into 3
 * <pre>
 * {@code
 *    unzip3(Streamable.of(new Tuple3(1, "a", 2l), new Tuple3(2, "b", 3l), new Tuple3(3,"c", 4l)))
 * }
 * // Streamable[1,2,3], Streamable[a,b,c], Streamable[2l,3l,4l]
 * </pre>
 */
public static <T1, T2, T3> Tuple3<Streamable<T1>, Streamable<T2>, Streamable<T3>> unzip3(final Streamable<Tuple3<T1, T2, T3>> sequence) {
  return ReactiveSeq.unzip3(sequence.stream())
           .map1(s -> fromStream(s))
           .map2(s -> fromStream(s))
           .map3(s -> fromStream(s));
}

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法