-
Notifications
You must be signed in to change notification settings - Fork 641
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from hilihan/master
作业提交
- Loading branch information
Showing
2 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package cn.mark; | ||
/** | ||
* 自定义实现LinkedList数据结构 | ||
* @author hilih | ||
* | ||
*/ | ||
public class MyLinkedList implements MyList{ | ||
|
||
private Node head; | ||
private int size;//集合的长度 | ||
|
||
/** | ||
* 添加元素 | ||
*/ | ||
@Override | ||
public boolean add(Object o) { | ||
//为空判断 | ||
if ( o == null ){ | ||
System.out.println("不允许null的元素插入!"); | ||
return false; | ||
} | ||
if(head == null){ | ||
head = new Node(); | ||
head.data = o; | ||
}else{ | ||
|
||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public boolean add(int index, Object o) { | ||
// TODO Auto-generated method stub | ||
return false; | ||
} | ||
|
||
@Override | ||
public Object get(int index) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public Object remove(int index) { | ||
// TODO Auto-generated method stub | ||
return null; | ||
} | ||
|
||
@Override | ||
public int size() { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
} | ||
|
||
private static class Node{ | ||
Object data; | ||
Node next; | ||
} | ||
|
||
|
||
public static void main(String[] args) { | ||
|
||
|
||
} | ||
|
||
} |