Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class InvertiLista {
- public static LinkedList<Integer> invertiLista(ListIterator<Integer> li)
- {
- if ( li.hasNext() )
- {
- int x = li.next();
- LinkedList<Integer> result = invertiLista(li);
- result.add(x);
- return result;
- }
- else
- { return new LinkedList<Integer>(); }
- }
- }
Add Comment
Please, Sign In to add comment