I have an array that is initialized like:
Element[] array = {new Element(1), new Element(2), new Element(3)};
I would like to convert this
as all said this will do so
new ArrayList<>(Arrays.asList("1","2","3","4"));
and the common newest way to create array is observableArrays
ObservableList: A list that allows listeners to track changes when they occur.
for Java SE you can try
FXCollections.observableArrayList(new Element(1), new Element(2), new Element(3));
that is according to Oracle Docs
observableArrayList() Creates a new empty observable list that is backed by an arraylist. observableArrayList(E... items) Creates a new observable array list with items added to it.
also in Java 9 it's a little bit easy:
List list = List.of("element 1", "element 2", "element 3");