Skip to content

Instantly share code, notes, and snippets.

@john-nash-rs
Created August 12, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-nash-rs/0f4a2aaa60a1aee8ef4ed981dd6ca65c to your computer and use it in GitHub Desktop.
Save john-nash-rs/0f4a2aaa60a1aee8ef4ed981dd6ca65c to your computer and use it in GitHub Desktop.
package com.company;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Stream;
public class Main {
public static void main(String[] args) {
List<String> numList =
Arrays.asList("11","2", "3", "four", "5", "6", "7", "8");
numList.stream()
.filter(str -> !str.contains("3"))
.flatMap(str -> Stream.of(str + " " + " right? "))
.distinct()
.map(str -> str.split(" ")[0])
.limit(3)
.skip(1)
.sorted()
.forEach(str -> System.out.println(str));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment