Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String []args) {
- SLL<Integer> lista = new SLL<>();
- lista.insertLast(3);
- lista.insertLast(4);
- lista.insertLast(7);
- lista.insertLast(6);
- lista.insertLast(4);
- lista.insertLast(7);
- lista.insertLast(3);
- lista.insertLast(2);
- SLLNode<Integer> last = lista.getFirst();
- SLLNode<Integer> first = lista.getFirst();
- SLLNode<Integer> prevLast = null;
- while (last.succ != null) {
- prevLast = last;
- last = last.succ;
- }
- prevLast.succ = null;
- //System.out.println(lista.toString());
- last.succ = first.succ;
- first.succ = last;
- //System.out.println(lista.toString());
- lista.first = last;
- first.succ = null;
- prevLast.succ = first;
- System.out.println(lista.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement