Class LongList
- java.lang.Object
-
- org.onemind.commons.java.datastructure.LongList
-
public class LongList extends java.lang.Object
Represents 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
_count
the count of longs in the list *private long[]
_list
the list *private static int
GROW
the growth rate *private static int
INITIAL_CAPACITY
the initial capacity *
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long l)
Add a long to the listvoid
add(long l, int i)
Add a long at index iprivate void
ensureCapacity(int size)
ensure the capacity of the longlong
first()
Return the first long in the listlong
get(int i)
Get the long on index i in the listlong
last()
Return the last long in the listlong
remove(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
-
-