Thanks to cyclops, i have now use... #179

Closed
langzhaozhi opened this Issue Apr 2, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@langzhaozhi

Thanks to cyclops, I have now use cyclops-react to write my code. I need parallel converting hundards of microfost excel xsl files to xlsx format files in order to later process by java. The following code is just doing this thing, and i feel comfortable by using cyclops-react.

LazyFutureStream<File> xlsStream = LazyReact.parallelBuilder(8 + 1)
                .async()
                .of(new File("../2016-04").listFiles(File::isDirectory))
                .peek(aDir-> System.out.println("Dir:" + aDir.getName()))
                .map(aDir->aDir.listFiles(aFile->aFile.getName().toLowerCase().endsWith(".xls")))
                .map(ListX::of)
                .flatten();
xlsStream.peek(aXlsFile-> System.out.println("Begin Convert:" + aXlsFile.getName() + "..."))
                .map(ExcelUtils::convertXlsToXlsx)
                .peek(aXlsxFile-> System.out.println("    Converted:" + aXlsxFile.getName()))
                .futureOperations()
                .toList()
                .thenAccept(aFileList-> System.out.println("Over! All Converted[" + aFileList.size() + "] XLS Files to XLSX Files"));
@johnmcclean

This comment has been minimized.

Show comment
Hide comment
@johnmcclean

johnmcclean Mar 8, 2017

Member

Nice :)

Member

johnmcclean commented Mar 8, 2017

Nice :)

@johnmcclean johnmcclean closed this Mar 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment