首页 > 其他 > 详细

LinkedList implement

时间:2014-05-07 08:23:53      阅读:349      评论:0      收藏:0      [点我收藏+]
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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!