Skip to content

Instantly share code, notes, and snippets.

@AnnaBoro
Last active December 8, 2015 21:04
Show Gist options
  • Save AnnaBoro/c4c77919a8130c5db309 to your computer and use it in GitHub Desktop.
Save AnnaBoro/c4c77919a8130c5db309 to your computer and use it in GitHub Desktop.
MyList3 + addFirst()
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