tinyield / sek-usage-lib

Sek library usage in Java of Kotlin Sequence

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sek-usage

Gradle project example of Sek library usage in Java for Kotlin Sequence.

git clone https://github.com/tinyield/sek-usage.git
cd sek-usage
gradlew run

Output:

505 by Arctic Monkeys
Mural by Lupe Fiasco

This demo runs the following code snippet:

Sek<Song> songs = Sek.of(
            new Song("505", "Alternative"),
            new Song("Amsterdam", "Alternative"),
            new Song("Mural", "Hip-Hop"));

Sek<Artist> artists = Sek.of(
            new Artist("Arctic Monkeys", "band"),
            new Artist("Nothing But Thieves", "band"),
            new Artist("Lupe Fiasco", "solo-artist"));

songs
    .filterNot(song -> song.getName().startsWith("A"))
    .map(Song::getName)
    .zip(artists.distinctBy(Artist::getKind).map(Artist::getName))
    .map(pair -> String.format("%s by %s", pair.getFirst(), pair.getSecond()))
    .forEach(System.out::println);

About

Sek library usage in Java of Kotlin Sequence

License:Apache License 2.0


Languages

Language:Java 100.0%