public class IntList extends ElementList
Modifier and Type | Field and Description |
---|---|
protected int[] |
list
Element container.
|
size
Constructor and Description |
---|
IntList()
Default constructor.
|
IntList(double resize)
Constructor, specifying a resize factor.
|
IntList(int capacity)
Constructor, specifying an initial internal array size.
|
IntList(int[] elements)
Lightweight constructor, adopting the specified elements.
|
Modifier and Type | Method and Description |
---|---|
IntList |
add(int... elements)
Adds elements to the array.
|
IntList |
add(int element)
Adds an element to the array.
|
boolean |
contains(int element)
Checks if the specified element is found in the list.
|
void |
delete(int element)
Removes all occurrences of the specified element from the list.
|
IntList |
distinct()
Removes duplicate entries from a sorted list.
|
int[] |
finish()
Returns an array with all elements and invalidates the internal array.
|
int |
get(int index)
Returns the element at the specified position.
|
void |
incFrom(int diff,
int index)
Adds a difference to all elements starting from the specified index.
|
void |
insert(int index,
int[] element)
Inserts elements at the specified index position.
|
int[] |
next()
Returns an array with all elements and resets the array size.
|
int |
peek()
Returns the uppermost element from the stack.
|
int |
pop()
Pops the uppermost element from the stack.
|
void |
push(int element)
Pushes an element onto the stack.
|
int |
remove(int index)
Deletes the element at the specified position.
|
void |
set(int index,
int element)
Stores an element at the specified position.
|
IntList |
sort()
Sorts the data.
|
void |
sort(byte[][] tok,
boolean num,
boolean asc)
Sorts the data in the order of the specified token array.
|
void |
sort(double[] num,
boolean asc)
Sorts the data in the order of the specified numeric array.
|
void |
sort(int[] num,
boolean asc)
Sorts the data in the order of the specified numeric array.
|
int |
sortedIndexOf(int element)
Searches the specified element via binary search.
|
int[] |
toArray()
Returns an array with all elements.
|
String |
toString() |
public IntList()
public IntList(int capacity)
capacity
- initial array capacitypublic IntList(double resize)
resize
- resize factorpublic IntList(int[] elements)
elements
- initial arraypublic final IntList add(int element)
element
- element to be addedpublic final IntList add(int... elements)
elements
- elements to be addedpublic final int get(int index)
index
- index of the element to returnpublic final void set(int index, int element)
index
- index of the element to replaceelement
- element to be storedpublic final boolean contains(int element)
element
- element to be foundpublic final void insert(int index, int[] element)
index
- inserting positionelement
- elements to be insertedpublic final void delete(int element)
element
- element to be removedpublic final int remove(int index)
index
- index of the element to deletepublic final void incFrom(int diff, int index)
diff
- differenceindex
- index of the first elementpublic final int peek()
public final int pop()
public final void push(int element)
element
- elementpublic final int sortedIndexOf(int element)
element
- element to be foundpublic final int[] toArray()
public int[] next()
public int[] finish()
public IntList distinct()
public IntList sort()
public final void sort(byte[][] tok, boolean num, boolean asc)
Arrays.sort(int[])
.tok
- token array to sort bynum
- numeric sortasc
- ascendingpublic final void sort(double[] num, boolean asc)
Arrays.sort(int[])
.num
- token array to sort byasc
- ascendingpublic final void sort(int[] num, boolean asc)
Arrays.sort(int[])
.num
- token array to sort byasc
- ascendingCopyright © 2005–2015 BaseX Team. All rights reserved.