So I know how to have a linked list and use add method to input entries by entries. However, I do not want to add entries by entries. Is there a way to declare a linkedlist with initial values in the list?
For example, if I want to have 1.0 & 2.0 in the list is there something I can do in one line? Something like:
List<Double> temp1 = new LinkedList<Double>(1,2);
You can do that this way:
List<Double> temp1 = new LinkedList<Double>(Arrays.asList(1.0, 2.0));