Last active
December 8, 2015 21:04
-
-
Save AnnaBoro/c4c77919a8130c5db309 to your computer and use it in GitHub Desktop.
MyList3 + addFirst()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lesson7.mylist; | |
public class SimpleLinkedList { | |
private Node root; | |
private int size; | |
public SimpleLinkedList() { | |
size = 0; | |
} | |
public void addFirst(Object o) { | |
Node node = new Node(); | |
node.object = o; | |
if(root != null) { | |
node.node = root; | |
} | |
root = node; | |
size++; | |
} | |
public void addLast(Object o) { | |
} | |
public void addAfter(Object o, Object n) { | |
} | |
public int getSize() { | |
return size; | |
} | |
private class Node { | |
private Object object; | |
private Node node; | |
public Node() { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment