Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch.claude_martin.playground;
- import java.util.Arrays;
- import java.util.List;
- import java.util.stream.Collectors;
- public class SomeClass {
- public static void main(String[] args) {
- int[] a = { 1, 2, 3, 4 };
- List<Integer> list = toList(a);
- System.out.println(list);
- }
- public static List<Integer> toList(int[] a) {
- return Arrays.stream(a).mapToObj(Integer::valueOf).collect(Collectors.toList());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement