Skip to content

Commit ed776ab

Browse files
committed
LinkedList add a throw
1 parent 71b3352 commit ed776ab

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)