Hello, I want help please. How can I put live data in LinkedList for create a list few elements?
I try this code that put the new data in [0] index but no keep old data in the list as I would like. List l = new LinkedList(); l.add(open); for (int i = 0; i< l.size(); i++) System.out.println(" Element à l'index " + i + "=" + l.get(i)); The code put the new data but remove the oldest. My target is create a dynamic list of two elements, a new data and the previous.
list.add(Object o); // Appends the specified element to the end of this list list.remove(int index) // Removes the element at the specified position in this list (optional operation).