You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@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 text was updated successfully, but these errors were encountered:
The internal array in IntArrayList, after this set of operations, is:
Fix?
The text was updated successfully, but these errors were encountered: