Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

sphereio/java-8-notebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

docs

Optional

Collections and Streams

Streams

Stream of Stream

final Stream<Stream<String>> streamStream = createStreameSomeHow();
final List<String> result = streamStream
        .reduce(Stream.empty(), Stream::concat)
        .collect(toList());

Lists

partition

final List<String> list = asList("a", "ba", "aaa", "baaa", "aaa", "ba");
final Map<Boolean, List<String>> map = list.stream()
    .collect(Collectors.partitioningBy(s -> s.startsWith("a")));
assertThat(map.get(true)).contains("a", "aaa", "aaa");
assertThat(map.get(false)).contains("ba", "baaa", "ba");

Lambda Functions and closures

Weird stuff

final Predicate<String> predicate = "GET"::equals;

CompletableFuture and CompletionStage

Articles

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published