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

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

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

ReactiveSeq.findFirst介绍

暂无

代码示例

代码示例来源:origin: aol/micro-server

public SpringContextFactory(Config config, Class<?> c, Set<Class<?>> classes) {
  PersistentSet<Class> s = config.getClasses()
          .plusAll(classes);
  s= s.plus(c);
  Microserver microserver = c.getAnnotation(Microserver.class);
  final PersistentSet<Class> immutableS = s;
  s = Optional.ofNullable(microserver)
        .flatMap(ms -> Optional.ofNullable(ms.blacklistedClasses()))
        .map(bl -> {
          Set<Class> blacklistedClasses = Arrays.stream(bl)
                             .collect(Collectors.toSet());
          return (PersistentSet<Class>)immutableS.stream()
                   .filter(clazz -> !blacklistedClasses.contains(clazz)).hashSet();
        })
        .orElse(immutableS);
  this.classes = s;
  this.config = config;
  springBuilder = ReactiveSeq.fromStream(PluginLoader.INSTANCE.plugins.get()
                                    .stream())
                .filter(m -> m.springBuilder() != null)
                .map(Plugin::springBuilder)
                .findFirst()
                .orElse(new SpringApplicationConfigurator());
}

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

@Override
public boolean containsValue(T value) {
  return stream().filter(i->Objects.equals(i,value)).findFirst().isPresent();
}
@Override

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

default boolean containsValue(T value){
  return stream().filter(o-> Objects.equals(value,o)).findFirst().isPresent();
}
boolean isEmpty();

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

default boolean noneMatch(final Predicate<? super T> c) {
  return !stream().filter(c)
          .findFirst()
           .isPresent();
}

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

default  boolean allMatch(Predicate<? super Tuple2<K,V>> c){
  return !stream().filterNot(c)
    .findFirst()
    .isPresent();
}
default boolean equalTo(PersistentMap<K,V> map){

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

@Test
public void findFirst(){
  assertThat(Spouts.of(1,2,3).findFirst().get(),equalTo(1));
}

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

@Test
public void testFindFirst(){
  assertThat(Arrays.asList(1,2,3),hasItem(of(1,2,3,4,5).filter(it -> it <3).findFirst().get()));
}
@Test

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

@Test
public void testFindFirst(){
  assertThat(Arrays.asList(1,2,3),hasItem(of(1,2,3,4,5).filter(it -> it <3).findFirst().get()));
}
@Test

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

@Test
public void testFindFirst(){
  assertThat(Arrays.asList(1,2,3),hasItem(of(1,2,3,4,5).filter(it -> it <3).findFirst().get()));
}
@Test

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

@Test
public void testCombineMonoid(){
  assertThat(of(1,1,2,3)
      .combine(Monoids.intMult,(a, b)->a.equals(b))
      .findFirst().get()
      , equalTo(1));
}
@Test

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

@Test
public void testFindFirst(){
  assertThat(Arrays.asList(1,2,3),hasItem(of(1,2,3,4,5).filter(it -> it <3).findFirst().get()));
}
@Test

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

@Test
public void testCombineMonoidTwo(){
  assertThat(of(1,1,2,3)
          .combine((a, b)->a.equals(b),Monoids.intMult)
          .findFirst().get()
      , equalTo(1));
}
@Test

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

@Test
public void combineTerminate() {
  assertThat(of(1, 2, 3, 4, 5, 6, 7, 8)
      .combine((a, b) -> a < 5, Semigroups.intSum)
      .findFirst(), Matchers.equalTo(Optional.of(6)));
}

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

@Test
public void testLimitLast1(){
  assertThat(of(1,2,3,4,5)
      .takeRight(1)
      .findFirst().get(),equalTo(5));
  assertThat(of(1,2,3,4,5)
      .takeRight(1)
      .collect(Collectors.toList()),equalTo(Arrays.asList(5)));
}
@Test

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().toList());
  assertThat(of("a").zipWithIndex().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().toList());
}

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().toList());
  assertThat(of("a").zipWithIndex().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().toList());
}

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().toList());
  assertThat(of("a").zipWithIndex().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().toList());
}

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().toList());
  assertThat(of("a").zipWithIndex().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().toList());
}

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().to(Streamable::fromStream).toList());
  assertThat(of("a").zipWithIndex().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().to(Streamable::fromStream).toList());
}

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

@Test
public void testZipWithIndex() {
  assertEquals(asList(), of().zipWithIndex().stream().toList());
  assertThat(of("a").zipWithIndex().stream().map(t -> t._2()).findFirst().get(), is(0l));
  assertEquals(asList(Tuple.tuple("a", 0L)), of("a").zipWithIndex().stream().toList());
}

相关文章

微信公众号

最新文章

更多

ReactiveSeq类方法