Class LongList
- java.lang.Object
-
- org.onemind.commons.java.datastructure.LongList
-
public class LongList extends java.lang.ObjectRepresents a list of long- Version:
- $Id: LongList.java,v 1.2 2004/08/26 12:33:16 thlee Exp $ $Name: $
- Author:
- TiongHiang Lee (thlee@onemindsoft.org)
-
-
Field Summary
Fields Modifier and Type Field Description private int_countthe count of longs in the list *private long[]_listthe list *private static intGROWthe growth rate *private static intINITIAL_CAPACITYthe initial capacity *
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(long l)Add a long to the listvoidadd(long l, int i)Add a long at index iprivate voidensureCapacity(int size)ensure the capacity of the longlongfirst()Return the first long in the listlongget(int i)Get the long on index i in the listlonglast()Return the last long in the listlongremove(int i)Remove the long at index i
-
-
-
Field Detail
-
INITIAL_CAPACITY
private static final int INITIAL_CAPACITY
the initial capacity *- See Also:
- Constant Field Values
-
GROW
private static final int GROW
the growth rate *- See Also:
- Constant Field Values
-
_count
private int _count
the count of longs in the list *
-
_list
private long[] _list
the list *
-
-
Method Detail
-
add
public void add(long l)
Add a long to the list- Parameters:
l- the long
-
get
public long get(int i)
Get the long on index i in the list- Parameters:
i- the index- Returns:
- the long
-
add
public void add(long l, int i)Add a long at index i- Parameters:
l- the longi- the index
-
ensureCapacity
private void ensureCapacity(int size)
ensure the capacity of the long- Parameters:
size- the size
-
remove
public long remove(int i)
Remove the long at index i- Parameters:
i- the index- Returns:
- the long at index i
-
first
public long first()
Return the first long in the list- Returns:
- the first long
-
last
public long last()
Return the last long in the list- Returns:
- the last long
-
-