- 1
How can I extract numbers in a linked list and store them into a string?
3 Réponses
+ 4
Sci There are a number of method that help us to get the element from Linkedlist.
1. get(int index) method
2. getFirst() method
3. getLast() method
4. peek() method
5. peekFirst() method
6. peekLast() method
7. element() method
You can see the working of each and how to get the element.
https://javagoal.com/get-the-element-from-linkedlist/
+ 3
First create an empty string.
Then traverse through the Linked list. As you get the data of the list node, append that to the String.
Make sure string is globally defined.
0
java.util.LinkedList has .get(int index) method
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/LinkedList.html
"some string "+element from LinkedList can append it to string