public class IntList extends Object
Constructor and Description |
---|
IntList()
Create an empty list with a default capacity.
|
IntList(int capacity)
Create an empty list with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int n)
Add an entry to the end of the list.
|
void |
clear()
Empty this list
|
boolean |
contains(int value)
Check if an entry appears in this collection.
|
void |
fillTo(int toIndex,
int val)
Pad the list with entries.
|
int |
get(int i)
Get the value at the specified index
|
void |
set(int index,
int n)
Assign an entry in the list.
|
int |
size()
Get number of entries in this list.
|
String |
toString() |
public IntList()
public IntList(int capacity)
capacity
- number of entries the list can initially hold.public int size()
public boolean contains(int value)
value
- the value to search for.value
appears in this list.public int get(int i)
i
- index to read, must be in the range [0, size()
).ArrayIndexOutOfBoundsException
- the index outside the valid rangepublic void clear()
public void add(int n)
n
- the number to add.public void set(int index, int n)
index
- index to set, must be in the range [0, size()
).n
- value to store at the position.public void fillTo(int toIndex, int val)
toIndex
- index position to stop filling at. 0 inserts no filler. 1
ensures the list has a size of 1, adding val
if
the list is currently empty.val
- value to insert into padded positions.Copyright © 2018 Eclipse JGit Project. All rights reserved.