Guest User

Untitled

a guest
Jan 17th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class InvertiLista {
  4.    
  5.     public static LinkedList<Integer> invertiLista(ListIterator<Integer> li)
  6.         {
  7.             if ( li.hasNext() )
  8.                 {
  9.                     int x = li.next();
  10.                     LinkedList<Integer> result = invertiLista(li);
  11.                     result.add(x);
  12.                     return result;
  13.                 }
  14.             else
  15.                 {   return new LinkedList<Integer>(); }
  16.         }
  17.     }
Add Comment
Please, Sign In to add comment