массив Java для перечисления
Integer[] spam = new Integer[] { 1, 2, 3 };
List<Integer> list = Arrays.asList(spam);
2 Programmers 1 Bug
Integer[] spam = new Integer[] { 1, 2, 3 };
List<Integer> list = Arrays.asList(spam);
List<String> list = new ArrayList<>();
list.add("a");
list.add("ab");
list.add("abc");
list.add("abcd");
// convert
String[] array = list.toArray();
ArrayList<String> ArrayLister=new ArrayList<>(){ArrayLister.add("Hi")};
String[] array=ArrayLister.toArray(String[]);
new ArrayList( Arrays.asList( new String[]{"abc", "def"} ) );
ArrayList<Integer> list = new ArrayList<>(OtherList);
//it will copy all elements from OtherList to this one
//time complexity - O(n)
List<Integer> vals = IntStream.of(shuffled).boxed().collect(Collectors.toList());