Skip to content

Commit

Permalink
修改arraylist
Browse files Browse the repository at this point in the history
  • Loading branch information
northSmall committed Feb 26, 2017
1 parent 8e7b643 commit 4e61361
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ public Object get(int index){
}

public Object remove(int index){
return null;
checkIndex(index);
Object obj = elementData[index];
System.arraycopy(elementData, index+1, elementData, index,
size - index-1);
return obj;
}

public int size(){
Expand All @@ -45,5 +49,5 @@ private void checkIndex(int index){
if (index>elementData.length)
throw new IndexOutOfBoundsException();
}

}

0 comments on commit 4e61361

Please sign in to comment.