Skip to content

Commit 7f0db0b

Browse files
author
Rong Huang
authored
Merge pull request onlyliuxin#25 from Ven13/master
LinkedList add a throw
2 parents 54de242 + ed776ab commit 7f0db0b

File tree

1 file changed

+3
-0
lines changed
  • group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic

1 file changed

+3
-0
lines changed

group02/106614649/106614649Learnin/src/com/github/Ven13/coding2017/basic/LinkedList.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public Object get(int index) {
8585

8686
@Override
8787
public Object remove(int index) {
88+
if(size == 0) {
89+
throw new java.util.NoSuchElementException();
90+
}
8891
if(index == 0) {
8992
Node node = head;
9093
Node temp = node.next;

0 commit comments

Comments
 (0)