@Test
public void testArrayListSortThis() {
final IntArrayList list = new IntArrayList();
list.add(6);
list.add(5);
list.sortThis();
assertEquals(5, list.get(0));
}
Expected :5
Actual :0
The internal array in IntArrayList, after this set of operations, is:
new int[] { 0,0,0,0,0,0,0,0,5,6 }
Fix?
public IntArrayList sortThis()
{
Arrays.sort(this.items, 0, this.size);
return this;
}
The internal array in IntArrayList, after this set of operations, is:
Fix?