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/e6e925ddb0bf8f4f8f0009d6eaba339a to your computer and use it in GitHub Desktop.
Save higaki/e6e925ddb0bf8f4f8f0009d6eaba339a to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.stream.Collectors;
public class ex1 {
public static void main(String args[]) {
// var a = Arrays.asList(1, 2, 3, 5);
var a = Arrays.asList(args)
.stream()
.map(i -> Integer.parseInt(i))
.collect(Collectors.toList());
var result = a.stream().map(i -> i * 2);
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