Skip to content

Instantly share code, notes, and snippets.

@higaki
Created February 3, 2020 23:58
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 higaki/41af17f42883fbec5e8d270f67eb6a7a to your computer and use it in GitHub Desktop.
Save higaki/41af17f42883fbec5e8d270f67eb6a7a to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.stream.Collectors;
public class ex2 {
public static void main(String[] args) {
var a = Arrays.asList(1, 2, 3, 5);
var result = a.stream().filter(i -> i % 2 == 1);
System.out.println(
result.map(i -> i.toString())
.collect(Collectors.joining(", ", "[", "]")));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment