当前位置: 首页>>代码示例>>Java>>正文


Java ListX类代码示例

本文整理汇总了Java中cyclops.collections.mutable.ListX的典型用法代码示例。如果您正苦于以下问题:Java ListX类的具体用法?Java ListX怎么用?Java ListX使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ListX类属于cyclops.collections.mutable包,在下文中一共展示了ListX类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findDir

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
private List<RegisterEntry> findDir(File dir) {
    List<RegisterEntry> result = new ArrayList<>();

    Stream.of(dir.listFiles()).forEach(
        (next) -> {

            if (next.isDirectory()) {
                result.addAll(findDir(next));
            }
            if (next.isFile()) {
                try {
                    String fileString = FileUtils.readFileToString(next);
                    result.add(JacksonUtil.convertFromJson(fileString, RegisterEntry.class));
                } catch (Exception e) {
                    logger.error("Error loading service entry from disk {}", e,
                        next.getAbsolutePath());

                }
            }
        });
    return ListX.fromIterable(result);
}
 
开发者ID:aol,项目名称:micro-server,代码行数:23,代码来源:Finder.java

示例2: addRemove

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void addRemove(){
   ListX.of(1,2,3)
        .add(1);
   //[1,2,3,4]

   ListX.of(1,2,3)
           .plus(1);
   //[1,2,3,4]

   ListX.of(1,2,3)
           .remove(1);
   //[2,3]

   ListX.of(1,2,3)
           .removeValue((Object)1);
   //[2,3]
}
 
开发者ID:aol,项目名称:cyclops,代码行数:19,代码来源:AsyncActiveTest.java

示例3: testSorted

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void testSorted() {

    AnyM.fromList(ListX.of(tuple(2, 2), tuple(1, 1))).printOut();
    Traversable<Tuple2<Integer, Integer>> t1 = of(tuple(2, 2), tuple(1, 1));

    List<Tuple2<Integer, Integer>> s1 = t1.sorted().stream().toList();
    assertEquals(tuple(1, 1), s1.get(0));
    assertEquals(tuple(2, 2), s1.get(1));

    Traversable<Tuple2<Integer, String>> t2 = of(tuple(2, "two"), tuple(1, "one"));
    List<Tuple2<Integer, String>> s2 = t2.sorted(comparing(t -> t._1())).stream().toList();
    assertEquals(tuple(1, "one"), s2.get(0));
    assertEquals(tuple(2, "two"), s2.get(1));

    Traversable<Tuple2<Integer, String>> t3 = of(tuple(2, "two"), tuple(1, "one"));
    List<Tuple2<Integer, String>> s3 = t3.sorted(t -> t._1()).stream().toList();
    assertEquals(tuple(1, "one"), s3.get(0));
    assertEquals(tuple(2, "two"), s3.get(1));
}
 
开发者ID:aol,项目名称:cyclops,代码行数:21,代码来源:AbstractTraversableTest.java

示例4: triplicateFanOut

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void triplicateFanOut() {

    for (int k = 0; k < ITERATIONS; k++) {
        System.out.println("******************Triplicate & product.. " + k);
        System.out.println("******************Triplicate & product.. " + k);
        System.out.println("******************Triplicate & product.. " + k);
        System.out.println("******************Triplicate & product.. " + k);
        ListX<Integer> res = of(1, 2, 3, 4, 5, 6, 7, 8, 9)
                .fanOut(s1 -> s1.peek(System.out::println).filter(i -> i % 3 == 0).map(i -> i * 2),
                        s2 -> s2.filter(i -> i % 3 == 1).map(i -> i * 100),
                        s3 -> s3.filter(i -> i % 3 == 2).map(i -> i * 1000))
                .toListX();
        assertThat("List is "  + res,res, Matchers.hasItems(6, 100, 2000, 12, 400, 5000, 18, 700, 8000));
    }

}
 
开发者ID:aol,项目名称:cyclops,代码行数:18,代码来源:BaseSequentialTest.java

示例5: duplicateDuplicateDuplicate

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void duplicateDuplicateDuplicate(){
    for(int k=0;k<ITERATIONS;k++) {
        assertThat(of(1, 2, 3).duplicate()
                ._1().duplicate()._1().duplicate()._1().duplicate()._1().toListX(), equalTo(ListX.of(1, 2, 3)));
    }

}
 
开发者ID:aol,项目名称:cyclops,代码行数:9,代码来源:AsyncSequentialTest.java

示例6: splitLimit

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void splitLimit() {
    ReactiveSeq<Integer> stream = of(1);
    final Tuple2<ReactiveSeq<Integer>, ReactiveSeq<Integer>> t = stream.duplicate();
    assertThat(stream.limit(1).toList(), equalTo(ListX.of(1)));
    assertThat(t._1().limit(1).toList(), equalTo(ListX.of(1)));
    assertThat(t._1().limit(1).toList(), equalTo(ListX.of(1)));
}
 
开发者ID:aol,项目名称:cyclops,代码行数:9,代码来源:BaseSequentialTest.java

示例7: broadcastTest

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void broadcastTest() {
    Topic<Integer> topic = of(1, 2, 3)
            .broadcast();


    ReactiveSeq<Integer> stream1 = topic.stream();
    ReactiveSeq<Integer> stream2 = topic.stream();
    assertThat(stream1.toListX(), Matchers.equalTo(ListX.of(1, 2, 3)));
    assertThat(stream2.stream().toListX(), Matchers.equalTo(ListX.of(1, 2, 3)));

}
 
开发者ID:aol,项目名称:cyclops,代码行数:13,代码来源:BaseSequentialTest.java

示例8: defaultMultiDataWriter

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Bean
public MultiDataWriter<?> defaultMultiDataWriter() {
    if (multiWriterOn)
        return new MultiDataWriter(
                                   ListX.fromIterable(defaultComparators)
                                        .map(mc -> new AsyncDataWriter(
                                                                       asyncDataWriterThreadPool(), mc, bus)));
    return new MultiDataWriter(
                               ListX.empty());
}
 
开发者ID:aol,项目名称:micro-server,代码行数:11,代码来源:ConfigureDataWriter.java

示例9: contextInitialized

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Override
public void contextInitialized(ServletContextEvent arg0) {
	JerseyRestApplication.getResourcesMap().put(serverData.getModule().getContext(), ListX.fromIterable(serverData.getResources()));
	JerseyRestApplication.getPackages().put(serverData.getModule().getContext(), serverData.getModule().getDefaultJaxRsPackages());
	JerseyRestApplication.getResourcesClasses().put(serverData.getModule().getContext(), serverData.getModule().getDefaultResources());
	JerseyRestApplication.getResourceConfigManager().put(serverData.getModule().getContext(), serverData.getModule().getResourceConfigManager());
	JerseyRestApplication.getServerPropertyMap().put(serverData.getModule().getContext(), serverData.getModule().getServerProperties());
}
 
开发者ID:aol,项目名称:micro-server,代码行数:9,代码来源:JerseySpringIntegrationContextListener.java

示例10: cycleTests

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@org.junit.Test
public void cycleTests(){
    System.out.println(ListX.of(1,2,3)
            .cycle(2));

    System.out.println(ListX.of(5,6,7)
            .cycleWhile(i->i*times++<100));
}
 
开发者ID:aol,项目名称:cyclops,代码行数:9,代码来源:AsyncActiveTest.java

示例11: MicroserverApp

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
/**
 * This will construct a Spring context for this Microserver instance.
 * The calling class will be used to determine the base package to auto-scan from for Spring Beans
 * It will attempt to pick up an @Microservice annotation first, if not present the package of the calling class
 * will be used.
 * 
 * @param modules Multiple Microservice end points that can be deployed within a single Spring context
 */
public MicroserverApp(Module... modules) {
    this.modules = ListX.of(modules);
    GlobalState.state.setModules(this.modules);
    initSpringProperties(modules[0]);
    Class c = extractClass();
    springContext = new SpringContextFactory(
                                             new MicroserverConfigurer().buildConfig(c), extractClass(),
                                             modules[0].getSpringConfigurationClasses()).createSpringContext();

}
 
开发者ID:aol,项目名称:micro-server,代码行数:19,代码来源:MicroserverApp.java

示例12: cycleIterateIterable

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void cycleIterateIterable(){
	Iterator<Integer> it = ReactiveSeq.fromIterable(Arrays.asList(1)).stream().cycle(2).iterator();
	List<Integer> list2 = new ArrayList<>();
	while(it.hasNext())
		list2.add(it.next());
	assertThat(list2,equalTo(ListX.of(1,1)));
}
 
开发者ID:aol,项目名称:cyclops,代码行数:9,代码来源:AsyncRSReactiveStreamXTest.java

示例13: getDefaultJaxRsPackages

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Override
public List<String> getDefaultJaxRsPackages() {
    if (defaultJaxRsPackages != null)
        return ListX.fromIterable(concat(defaultJaxRsPackages, extract(() -> Module.super.getDefaultJaxRsPackages())));

    return ListX.fromIterable(Module.super.getDefaultJaxRsPackages());
}
 
开发者ID:aol,项目名称:micro-server,代码行数:8,代码来源:ConfigurableModule.java

示例14: batchBySizeAndTimeTime

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void batchBySizeAndTimeTime(){

	for(int i=0;i<10;i++){
		System.out.println(i);
		List<ListX<Integer>> list = of(1,2,3,4,5,6)
				.groupedBySizeAndTime(10,1,TimeUnit.MICROSECONDS)
				.toList();

		assertThat(list
						.get(0)
						,not(hasItem(6)));
	}
}
 
开发者ID:aol,项目名称:cyclops,代码行数:15,代码来源:AsyncRSBatchingTest.java

示例15: splitLimit2

import cyclops.collections.mutable.ListX; //导入依赖的package包/类
@Test
public void splitLimit2(){
    ReactiveSeq<Integer> stream = of(1);
    final Tuple2<ReactiveSeq<Integer>, ReactiveSeq<Integer>> t = stream.duplicate();
    assertThat(stream.limit(1).toList(),equalTo(ListX.of(1)));

    assertThat(t._1().limit(1).toList(),equalTo(ListX.of(1)));
}
 
开发者ID:aol,项目名称:cyclops,代码行数:9,代码来源:AsyncSequentialTest.java


注:本文中的cyclops.collections.mutable.ListX类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。