Skip to content

rjmeats/JavaStreams

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 

Repository files navigation

JavaStreams

Some examples of using various Java Streams facilities, lambdas and functional interfaces to process various sets of data:

Stream facilities demonstrated include:

  • stream generation operations:
    • stream() - for Collection-based objects
    • IntStream.rangeClosed()
    • Stream.iterate()
    • Stream.generate()
    • Stream.empty()
    • Stream.of()
    • Stream.builder()
    • Stream.concat()
    • Arrays.stream()
    • Files.lines()
    • String.chars()
  • intermediate stream processing operations:
    • limit()
    • skip()
    • peek()
    • filter()
    • map(), mapToObj() - an IntStream method
    • flatMap()
    • distinct()
    • sorted()
    • parallel(), sequential()
  • terminal stream operations:
    • forEachOrdered(), forEach()
    • count(), min(), max()
    • sum(), average(), summaryStatistics() - IntStream methods
    • allMatch(), anyMatch(), noneMatch()
    • findAll(), findAny()
    • collect()
  • stream Collectors operations:
    • Collectors.toList() and .toSet()
    • Collectors.summingInt()
    • Collectors.averagingInt()
    • Collectors.maxBy() and .minBy()
    • Collectors.counting()
    • Collectors.joining()
    • Collectors.groupingBy()
    • Collectors.partitioningBy()
    • Collectors.reducing()
    • Collectors.toMap()
    • Collectors.toCollection()
    • Collectors.collectingAndThen()
    • and also a bespoke Collector generated by calling Collector.of() with a class implementing Supplier, BiConsumer and BinaryOperator interfaces

The examples also include cases of:

About

Examples of using Java Streams and Lambdas

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages