add sort (ascending) method

This commit is contained in:
2017-02-05 14:18:47 +01:00
parent a535761b46
commit f7870a15a7
2 changed files with 19 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package org.lucares.collections;
import java.util.Arrays;
import java.util.List;
/**
@@ -249,6 +250,13 @@ public class IntList {
return get(0, index);
}
/**
* Sorts the list into ascending order.
*/
public void sort() {
Arrays.sort(data, 0, index);
}
private void ensureCapacity(final int newElements) {
final int requiredCapacity = index + newElements;