public class ByteGapList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Note that this implementation is not synchronized.
GapList,
ByteObjGapList,
Serialized Form| Constructor and Description |
|---|
ByteGapList()
Default constructor.
|
ByteGapList(byte... that)
Copy constructor.
|
ByteGapList(java.util.Collection<java.lang.Byte> that)
Copy constructor.
|
ByteGapList(int capacity)
Construct a list with specified capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(byte elem) |
void |
add(int index,
byte elem) |
boolean |
addAll(byte... elems)
Adds all specified elements into this list.
|
boolean |
addAll(ByteGapList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(java.util.Collection<java.lang.Byte> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(int index,
byte... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addAll(int index,
ByteGapList list)
Inserts all of the elements in the specified list into this
list, starting at the specified position.
|
boolean |
addAll(int index,
java.util.Collection<java.lang.Byte> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
void |
addFirst(byte elem) |
void |
addLast(byte elem) |
int |
binarySearch(byte key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
binarySearch(int index,
int len,
byte key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
capacity()
Returns capacity of this ByteGapList.
|
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this ByteGapList instance
(The elements themselves are not copied).
|
boolean |
contains(byte elem) |
boolean |
containsAll(java.util.Collection<java.lang.Byte> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Byte> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
ByteGapList |
copy()
Returns a shallow copy of this ByteGapList instance
(the new list will contain the same elements as the source list, i.e. the elements themselves are not copied).
|
static void |
copy(ByteGapList src,
int srcIndex,
ByteGapList dst,
int dstIndex,
int len)
Copies elements from one ByteGapList to another.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
static ByteGapList |
create()
Create new list.
|
static ByteGapList |
create(byte... elems)
Create new list with specified elements.
|
static ByteGapList |
create(java.util.Collection<java.lang.Byte> coll)
Create new list with specified elements.
|
static ByteGapList |
create(int capacity)
Create new list with specified capacity.
|
byte |
element() |
static ByteGapList |
EMPTY() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this ByteGapList instance, if
necessary, to ensure that it can hold at least the number of elements
specified by the minimum capacity argument.
|
boolean |
equals(java.lang.Object obj) |
void |
fill(byte elem)
Fill list.
|
void |
fill(int index,
int len,
byte elem)
Fill specified elements.
|
byte |
get(int index) |
ByteGapList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
byte[] |
getArray(int index,
int len)
Returns specified range of elements from list.
|
byte |
getFirst() |
byte |
getLast() |
int |
hashCode() |
int |
indexOf(byte elem) |
void |
init()
Initialize the list to be empty.
|
void |
init(byte... elems)
Initialize the list to contain the specified elements only.
|
void |
init(java.util.Collection<java.lang.Byte> coll)
Initialize the list to contain the specified elements only.
|
void |
init(int capacity)
Initialize the list to be empty with specified capacity.
|
void |
init(int len,
byte elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(byte elem) |
static void |
move(ByteGapList src,
int srcIndex,
ByteGapList dst,
int dstIndex,
int len)
Moves elements from one ByteGapList to another.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(byte elem) |
boolean |
offerFirst(byte elem) |
boolean |
offerLast(byte elem) |
byte |
peek() |
byte |
peekFirst() |
byte |
peekLast() |
byte |
poll() |
byte |
pollFirst() |
byte |
pollLast() |
byte |
pop() |
void |
push(byte elem) |
byte |
remove() |
byte |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
boolean |
removeAll(ByteGapList coll) |
boolean |
removeAll(java.util.Collection<java.lang.Byte> coll) |
byte |
removeFirst() |
boolean |
removeFirstOccurrence(byte elem) |
byte |
removeLast() |
boolean |
removeLastOccurrence(byte elem) |
void |
resize(int len,
byte elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(ByteGapList coll) |
boolean |
retainAll(java.util.Collection<java.lang.Byte> coll) |
void |
reverse()
Reverses the order of all elements in the specified list.
|
void |
reverse(int index,
int len)
Reverses the order of the specified elements in the list.
|
void |
rotate(int distance)
Rotate specified elements in the list.
|
void |
rotate(int index,
int len,
int distance)
Rotate specified elements in the list.
|
byte |
set(int index,
byte elem) |
void |
setAll(int index,
byte... elems)
Replaces the specified elements.
|
void |
setAll(int index,
ByteGapList list)
Replaces the specified elements.
|
void |
setAll(int index,
java.util.Collection<java.lang.Byte> coll)
Replaces the specified elements.
|
int |
size() |
void |
sort()
Sort elements in the list using the specified comparator.
|
void |
sort(int index,
int len)
Sort specified elements in the list using the specified comparator.
|
static void |
swap(ByteGapList src,
int srcIndex,
ByteGapList dst,
int dstIndex,
int len)
Swaps elements from two GapLists.
|
void |
swap(int index1,
int index2,
int len)
Swap the specified elements in the list.
|
byte[] |
toArray() |
byte[] |
toArray(byte[] array) |
byte[] |
toArray(int index,
int len)
Returns an array containing the specified elements in this list.
|
java.lang.String |
toString() |
void |
trimToSize()
Trims the capacity of this ByteGapList instance to be the
list's current size.
|
ByteGapList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public ByteGapList()
public ByteGapList(int capacity)
capacity - capacity to usepublic ByteGapList(java.util.Collection<java.lang.Byte> that)
that - source object to copypublic ByteGapList(byte... that)
that - source object to copypublic static ByteGapList EMPTY()
public static ByteGapList create()
type - of elements stored in the listpublic static ByteGapList create(int capacity)
capacity - capacitytype - of elements stored in the listpublic static ByteGapList create(java.util.Collection<java.lang.Byte> coll)
coll - collection with elementtype - of elements stored in the listpublic static ByteGapList create(byte... elems)
elems - array with elementstype - of elements stored in the listpublic void init()
public void init(int capacity)
capacity - capacitypublic void init(java.util.Collection<java.lang.Byte> coll)
coll - collection with elementspublic void init(byte... elems)
elems - array with elementspublic ByteGapList copy()
clone()public ByteGapList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void clear()
public int size()
public int capacity()
public byte get(int index)
public byte set(int index,
byte elem)
public boolean add(byte elem)
public void add(int index,
byte elem)
public byte remove(int index)
public void ensureCapacity(int minCapacity)
minCapacity - the desired minimum capacitypublic void trimToSize()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isEmpty()
public int indexOf(byte elem)
public int lastIndexOf(byte elem)
public boolean contains(byte elem)
public boolean containsAny(java.util.Collection<java.lang.Byte> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Byte> coll)
public boolean removeAll(java.util.Collection<java.lang.Byte> coll)
public boolean removeAll(ByteGapList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Byte> coll)
public boolean retainAll(ByteGapList coll)
retainAll(Collection)public byte[] toArray()
public byte[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic byte[] toArray(byte[] array)
public boolean addAll(java.util.Collection<java.lang.Byte> coll)
coll - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is (byte)0public boolean addAll(int index,
java.util.Collection<java.lang.Byte> coll)
index - index at which to insert the first element from the
specified collectioncoll - collection containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is (byte)0public boolean addAll(byte... elems)
elems - elements to be added to this listpublic boolean addAll(int index,
byte... elems)
index - index at which to insert the first element from the
specified collectionelems - elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidpublic boolean addAll(ByteGapList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is (byte)0public boolean addAll(int index,
ByteGapList list)
index - index at which to insert the first element from the
specified collectionlist - list containing elements to be inserted into this listjava.lang.IndexOutOfBoundsException - if the index is invalidjava.lang.NullPointerException - if the specified collection is (byte)0public byte getFirst()
public byte getLast()
public void addFirst(byte elem)
public void addLast(byte elem)
public byte removeFirst()
public byte removeLast()
public byte peek()
public byte element()
public byte poll()
public byte remove()
public boolean offer(byte elem)
public boolean offerFirst(byte elem)
public boolean offerLast(byte elem)
public byte peekFirst()
public byte peekLast()
public byte pollFirst()
public byte pollLast()
public byte pop()
public void push(byte elem)
public boolean removeFirstOccurrence(byte elem)
public boolean removeLastOccurrence(byte elem)
public static void move(ByteGapList src, int srcIndex, ByteGapList dst, int dstIndex, int len)
src - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to movetype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void copy(ByteGapList src, int srcIndex, ByteGapList dst, int dstIndex, int len)
src - source listsrcIndex - index of first element in source listdst - destination listdstIndex - index of first element in source listlen - number of elements to copytype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic static void swap(ByteGapList src, int srcIndex, ByteGapList dst, int dstIndex, int len)
src - first listsrcIndex - index of first element in first listdst - second listdstIndex - index of first element in second listlen - number of elements to swaptype - of elements stored in the listjava.lang.IndexOutOfBoundsException - if the ranges are invalidpublic ByteGapList getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic byte[] getArray(int index,
int len)
index - index of first element to retrievelen - number of elements to retrievepublic void setAll(int index,
ByteGapList list)
index - index of first element to setlist - list with elements to setpublic void setAll(int index,
java.util.Collection<java.lang.Byte> coll)
index - index of first element to setcoll - collection with elements to setpublic void setAll(int index,
byte... elems)
index - index of first element to setelems - elements to setpublic void remove(int index,
int len)
index - index of first element to removelen - number of elements to removepublic void init(int len,
byte elem)
len and contain only the element elem.
The list will grow or shrink as needed.len - length of listelem - element which the list will containpublic void resize(int len,
byte elem)
len. If the list must grow, the specified
element elem will be used for filling.len - length of listelem - element which will be used for extending the listpublic void fill(byte elem)
elem - element used for fillingpublic void fill(int index,
int len,
byte elem)
index - index of first element to filllen - number of elements to fillelem - element used for fillingpublic void copy(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to copydstIndex - index of first destination element to copylen - number of elements to copypublic void move(int srcIndex,
int dstIndex,
int len)
srcIndex - index of first source element to movedstIndex - index of first destination element to movelen - number of elements to movepublic void reverse()
public void reverse(int index,
int len)
index - index of first element to reverselen - number of elements to reversepublic void swap(int index1,
int index2,
int len)
index1 - index of first element in first range to swapindex2 - index of first element in second range to swaplen - number of elements to swapjava.lang.IndexOutOfBoundsException - if the ranges overlappublic void rotate(int distance)
distance - distance to move the elementspublic void rotate(int index,
int len,
int distance)
index - index of first element to rotatelen - number of elements to rotatedistance - distance to move the elementspublic void sort()
comparator - comparator to use for sorting
((byte)0 means the elements natural ordering should be used)Arrays.sort(int[])public void sort(int index,
int len)
index - index of first element to sortlen - number of elements to sortcomparator - comparator to use for sorting
((byte)0 means the elements natural ordering should be used)Arrays.sort(int[])public int binarySearch(byte key)
key - the value to be searched forcomparator - the comparator by which the list is ordered.
A (byte)0 value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public int binarySearch(int index,
int len,
byte key)
index - index of first element to searchlen - number of elements to searchkey - the value to be searched forcomparator - the comparator by which the list is ordered.
A (byte)0 value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)