Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Revese a Linked List

LinkedList<Integer> ll = new LinkedList<>();

ll.add(1);
ll.add(2);
ll.add(3);
System.out.println(ll);

LinkedList<Integer> ll1 = new LinkedList<>();

ll.descendingIterator().forEachRemaining(ll1::add);

System.out.println(ll1);
Source by www.journaldev.com #
 
PREVIOUS NEXT
Tagged: #Revese #Linked #List
ADD COMMENT
Topic
Name
7+2 =