| Modifier and Type | Class and Description |
|---|---|
| public static interface | IntList.
A comparator of primitive ints. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | IntList(int
number of entries the list can initially hold. capacity)Create an empty list with the specified capacity. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public boolean | Returns: true ofvalue appears in this list.the value to search for. value)Check if an entry appears in this collection. |
| public static IntList | Returns: the list initialized with the given rangethe beginning of the range, inclusive start, int the end of the range, exclusive end)Create a list initialized with the values of the given range. |
| public void | fillTo(int
index position to stop filling at. 0 inserts no filler. 1
ensures the list has a size of 1, adding toIndex, int val if
the list is currently empty.value to insert into padded positions. val)Pad the list with entries. |
| public int | |
| private void | |
| private int | |
| private void | quickSort(int
the index to begin partitioning at, inclusive begin, int the index to end partitioning at, inclusive end, IntList.provides the comparison values for sorting the entries comparatorQuick sort has average time complexity of O(n log n) and O(log n) space complexity (for recursion on the stack). |
| public void | |
| public int | |
| public void | sort(IntList.
provides the comparison values for sorting the entries comparatorSort the entries of the list in-place, according to the comparator. |
| public String |
| IntList | back to summary |
|---|---|
| public IntList() Create an empty list with a default capacity. | |
| IntList | back to summary |
|---|---|
| public IntList(int capacity) Create an empty list with the specified capacity.
| |
| add | back to summary |
|---|---|
| public void add(int n) Add an entry to the end of the list.
| |
| clear | back to summary |
|---|---|
| public void clear() Empty this list | |
| contains | back to summary |
|---|---|
| public boolean contains(int value) Check if an entry appears in this collection.
| |
| filledWithRange | back to summary |
|---|---|
| public static IntList filledWithRange(int start, int end) Create a list initialized with the values of the given range.
| |
| fillTo | back to summary |
|---|---|
| public void fillTo(int toIndex, int val) Pad the list with entries.
| |
| get | back to summary |
|---|---|
| public int get(int i) Get the value at the specified index
| |
| grow | back to summary |
|---|---|
| private void grow() | |
| partition | back to summary |
|---|---|
| private int partition(int begin, int end, IntList. | |
| quickSort | back to summary |
|---|---|
| private void quickSort(int begin, int end, IntList. Quick sort has average time complexity of O(n log n) and O(log n) space complexity (for recursion on the stack). Implementation based on https://www.baeldung.com/java-quicksort.
| |
| set | back to summary |
|---|---|
| public void set(int index, int n) Assign an entry in the list.
| |
| size | back to summary |
|---|---|
| public int size() Get number of entries in this list.
| |
| sort | back to summary |
|---|---|
| public void sort(IntList. Sort the entries of the list in-place, according to the comparator.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: a negative number if first < second, 0 if first == second, or a positive number if first > secondthe first int to compare first, int the second int to compare second)Compares the two int arguments for order. |
| compare | back to summary |
|---|---|
| public int compare(int first, int second) Compares the two int arguments for order.
| |