|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vodafone360.people.utils.DynamicArrayLong
public class DynamicArrayLong
This class wraps the long primitive array into a dynamic array that can grows if necessary.
Field Summary | |
---|---|
private static int |
INITIAL_CAPACITY
The initial capacity if not given via the constructor. |
private long[] |
mArray
The wrapped long array. |
private int |
mIndex
The current index where the next item will be added in the array. |
Constructor Summary | |
---|---|
DynamicArrayLong()
Constructor. |
|
DynamicArrayLong(int capacity)
Constructor. |
Method Summary | |
---|---|
int |
add(long value)
Appends a value to the array. |
int |
add(long[] values)
Adds the provided array. |
long |
get(int position)
Gets the value from its given position in the array. |
int |
size()
Gets the size of the array (i.e. the count of added values) |
long[] |
toArray()
Gets an array of long containing all the values inside the DynamicArrayLong. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int INITIAL_CAPACITY
private long[] mArray
private int mIndex
Constructor Detail |
---|
public DynamicArrayLong()
public DynamicArrayLong(int capacity) throws java.lang.IllegalArgumentException
capacity
- the initial capacity of the array
java.lang.IllegalArgumentException
Method Detail |
---|
public int add(long value)
value
- the value to add
public int add(long[] values)
values
- the array to be added
public long get(int position) throws java.lang.ArrayIndexOutOfBoundsException
position
- the position of the value in the array
java.lang.ArrayIndexOutOfBoundsException
- if position not >=0 and < size()public int size()
public long[] toArray()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JavaDoc