Created
August 12, 2019 14:30
-
-
Save john-nash-rs/0f4a2aaa60a1aee8ef4ed981dd6ca65c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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