Answers for "change list to array java"

2

java list to array

List<Foo> list = new ArrayList<>();
Foo[] array = list.toArray(new Foo[0]);
Posted by: Guest on March-01-2021
0

convert array to list java

String[] myArray = new String[] { "I", "like", "eating", "pizza" };
List<String> myList = Arrays.asList(myArray);

myList.forEach(string -> System.out.println(string));

// -output-
// I
// like
// eating
// pizza
// -output-
Posted by: Guest on March-16-2021
-1

convert array to list java

Collections.addAll(list, array);
Posted by: Guest on November-23-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language