arrays - Reverse LinkedList in java -


i need understand simple example

 linkedlist list = new linkedlist();         list.add("j");         list.add("a");         list.add("v");         list.add("a"); 

i have simple linkedlist , need pass method reverse

public void reverse(linkedlist list) {  } 

which return reversed new list

and not need arraysutils reversing it

what short , practice way having reversed output.

the same needed understand simple arrays.

you can use collections class.

collections.reverse(list); 

your list reversed after operation.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -