|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectUtil.Structures.StaticIntList
public class StaticIntList
This is a simple implementation of a wrapper for a dynamically sized static array to hold ints. Does not support insertion of elements between a particular element or removal of elemnts but allow elements to change. When current size is reached the array size is doubled untill maxSize is reached
Field Summary | |
---|---|
int |
currentSize
|
int[] |
data
|
int |
initialSize
|
static int |
maxSize
|
Constructor Summary | |
---|---|
StaticIntList(int size)
Creates a new instance of StaticIntList |
|
StaticIntList(StaticIntList list)
Copy constructor |
Method Summary | |
---|---|
void |
add(int item)
Add int to list. |
int |
allocationSize()
Get the total |
void |
clear()
Clear list by setting current size to 0 |
int |
get(int index)
Get element at index |
int |
getMaxSize()
Get max size |
IntIterator |
iterator()
Create iterator over list |
static void |
main(java.lang.String[] args)
|
void |
set(int index,
int item)
Set element at index |
void |
setAll(int[] data)
Set all the elements to data |
void |
setMaxSize(int i)
Set max size |
int |
size()
Get current size of the list |
int[] |
toArray()
To array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int[] data
public int currentSize
public final int initialSize
public static int maxSize
Constructor Detail |
---|
public StaticIntList(int size)
size
- start size of int listpublic StaticIntList(StaticIntList list)
list
- object to copyMethod Detail |
---|
public void setMaxSize(int i)
i
- max sizepublic int getMaxSize()
public int get(int index)
get
in interface IntList
index
- element index
public void set(int index, int item)
set
in interface IntList
index
- index to set elementitem
- element to setpublic void setAll(int[] data)
data
- the set elementspublic void clear()
clear
in interface IntList
public int[] toArray()
toArray
in interface IntList
public IntIterator iterator()
iterator
in interface IntList
public void add(int item) throws java.lang.IndexOutOfBoundsException
add
in interface IntList
item
- item to add
java.lang.IndexOutOfBoundsException
public static void main(java.lang.String[] args)
public int size()
size
in interface IntList
public int allocationSize()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |