本文整理了Java中cyclops.reactive.ReactiveSeq.ofType
方法的一些代码示例,展示了ReactiveSeq.ofType
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ReactiveSeq.ofType
方法的具体详情如下:
包路径:cyclops.reactive.ReactiveSeq
类名称:ReactiveSeq
方法名:ofType
[英]Keep only those elements in a stream that are of a given type. // (1, 2, 3) ReactiveSeq.of(1, "a", 2, "b",3).ofType(Integer.class)
[中]只保留流中给定类型的元素。//(1,2,3)反应性。(1,“a”,2,“b”,3)中的一个。类型(Integer.class)
代码示例来源:origin: aol/cyclops
/**
* Keep only those elements in a stream that are of a given type.
*
*
* // (1, 2, 3) Streamable.of(1, "a", 2, "b",3).ofType(Integer.class)
*
*/
@Override
@SuppressWarnings("unchecked")
default <U> Streamable<U> ofType(final Class<? extends U> type) {
return fromStream(this.stream().ofType(type));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(Streams.ofType(Stream.of(1, "a", 2, "b", 3, null),Integer.class).collect(Collectors.toList()),containsInAnyOrder(1, 2, 3));
assertThat(ReactiveSeq.of(1, "a", 2, "b", 3, null).ofType(Integer.class).collect(Collectors.toList()),not(containsInAnyOrder("a", "b",null)));
assertThat(ReactiveSeq.of(1, "a", 2, "b", 3, null)
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(Spouts.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(Spouts.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b",null)));
assertThat(Spouts.of(1, "a", 2, "b", 3, null)
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(ReactiveSeq.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(ReactiveSeq.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b",null)));
assertThat(ReactiveSeq.of(1, "a", 2, "b", 3, null)
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(of(1, "a", 2, "b", 3, "c").ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(of(1, "a", 2, "b", 3,"c").ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b","c")));
assertThat(of(1, "a", 2, "b", 3, "c")
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3,"c"));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b",null)));
assertThat(of(1, "a", 2, "b", 3, null)
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(Spouts.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(Spouts.of(1, "a", 2, "b", 3, null).ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b",null)));
assertThat(Spouts.of(1, "a", 2, "b", 3, null)
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3));
}
代码示例来源:origin: aol/cyclops
@Test
public void testOfType() {
assertThat(of(1, "a", 2, "b", 3, "c").ofType(Integer.class).toList(),containsInAnyOrder(1, 2, 3));
assertThat(of(1, "a", 2, "b", 3,"c").ofType(Integer.class).toList(),not(containsInAnyOrder("a", "b","c")));
assertThat(of(1, "a", 2, "b", 3, "c")
.ofType(Serializable.class).toList(),containsInAnyOrder(1, "a", 2, "b", 3,"c"));
}
代码示例来源:origin: com.oath.cyclops/cyclops
/**
* Keep only those elements in a stream that are of a given type.
*
*
* // (1, 2, 3) Streamable.of(1, "a", 2, "b",3).ofType(Integer.class)
*
*/
@Override
@SuppressWarnings("unchecked")
default <U> Streamable<U> ofType(final Class<? extends U> type) {
return fromStream(this.stream().ofType(type));
}
内容来源于网络,如有侵权,请联系作者删除!