- 1

How can I extract numbers in a linked list and store them into a string?

24th Aug 2020, 4:37 AM
Azalea
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/
28th Aug 2020, 1:38 AM
Raina Dhankhar
Raina Dhankhar - avatar
+ 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.
24th Aug 2020, 5:16 AM
Charitra
Charitra - avatar
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
24th Aug 2020, 12:11 PM
zemiak