码迷,mamicode.com
首页 > 其他好文 > 详细

LinkedList implement

时间:2014-05-07 08:24:17      阅读:306      评论:0      收藏:0      [点我收藏+]

标签:style   class   ext   int   get   c   

public class LinkedList {


Node head = null;
Node tail = null;

int length = 0;

public void add(Object object) {
Node node  = new Node(object, null);
if (head == null) {
head = tail = node;
}

tail.setNext(node);
tail = node;
length++;
}

public int length() {
return length;
}

}


public class Node {


private Object data;
private Node next;


public Node(Object data, Node next) {
super();
this.data = data;
this.next = next;
}

public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}


}

LinkedList implement,布布扣,bubuko.com

LinkedList implement

标签:style   class   ext   int   get   c   

原文地址:http://blog.csdn.net/majiakun1/article/details/25083313

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!