public class BooleanGapList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Note that this implementation is not synchronized.
GapList,
BooleanObjGapList,
Serialized Form| Constructor and Description |
|---|
BooleanGapList()
Construct a list with the default initial capacity.
|
BooleanGapList(boolean... elems)
Construct a list to contain the specified elements.
|
BooleanGapList(java.util.Collection<java.lang.Boolean> coll)
Construct a list to contain the specified elements.
|
BooleanGapList(int capacity)
Construct a list with specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(boolean elem) |
void |
add(int index,
boolean elem) |
boolean |
addAll(boolean... elems)
Adds all specified elements into this list.
|
boolean |
addAll(BooleanGapList list)
Adds all of the elements in the specified list into this list.
|
boolean |
addAll(java.util.Collection<java.lang.Boolean> coll)
Adds all of the elements in the specified collection into this list.
|
boolean |
addAll(int index,
boolean... elems)
Inserts the specified elements into this list,
starting at the specified position.
|
boolean |
addAll(int index,
BooleanGapList 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.Boolean> coll)
Inserts all of the elements in the specified collection into this
list, starting at the specified position.
|
void |
addFirst(boolean elem) |
void |
addLast(boolean elem) |
int |
binarySearch(boolean key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
binarySearch(int index,
int len,
boolean key)
Searches the specified range for an object using the binary
search algorithm.
|
int |
capacity()
Returns capacity of this BooleanGapList.
|
void |
clear() |
java.lang.Object |
clone()
Returns a shallow copy of this BooleanGapList instance
(The elements themselves are not copied).
|
boolean |
contains(boolean elem) |
boolean |
containsAll(java.util.Collection<java.lang.Boolean> coll) |
boolean |
containsAny(java.util.Collection<java.lang.Boolean> coll)
Returns true if any of the elements of the specified collection is contained in the list.
|
BooleanGapList |
copy()
Returns a shallow copy of this BooleanGapList instance
(the new list will contain the same elements as the source list, i.e. the elements themselves are not copied).
|
static void |
copy(BooleanGapList src,
int srcIndex,
BooleanGapList dst,
int dstIndex,
int len)
Copies elements from one BooleanGapList to another.
|
void |
copy(int srcIndex,
int dstIndex,
int len)
Copy specified elements.
|
static BooleanGapList |
create()
Create new list.
|
static BooleanGapList |
create(boolean... elems)
Create new list with specified elements.
|
static BooleanGapList |
create(java.util.Collection<java.lang.Boolean> coll)
Create new list with specified elements.
|
static BooleanGapList |
create(int capacity)
Create new list with specified capacity.
|
boolean |
element() |
static BooleanGapList |
EMPTY() |
void |
ensureCapacity(int minCapacity)
Increases the capacity of this BooleanGapList 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(boolean elem)
Fill list.
|
void |
fill(int index,
int len,
boolean elem)
Fill specified elements.
|
boolean |
get(int index) |
BooleanGapList |
getAll(int index,
int len)
Returns specified range of elements from list.
|
boolean[] |
getArray(int index,
int len)
Returns specified range of elements from list.
|
boolean |
getFirst() |
boolean |
getLast() |
int |
hashCode() |
int |
indexOf(boolean elem) |
void |
init()
Initialize the list to be empty.
|
void |
init(boolean... elems)
Initialize the list to contain the specified elements only.
|
void |
init(java.util.Collection<java.lang.Boolean> coll)
Initialize the list to contain the specified elements only.
|
void |
init(int capacity)
Initialize the list to be empty with specified initial capacity.
|
void |
init(int len,
boolean elem)
Initializes the list so it will afterwards have a size of
len and contain only the element elem. |
boolean |
isEmpty() |
int |
lastIndexOf(boolean elem) |
static void |
move(BooleanGapList src,
int srcIndex,
BooleanGapList dst,
int dstIndex,
int len)
Moves elements from one BooleanGapList to another.
|
void |
move(int srcIndex,
int dstIndex,
int len)
Move specified elements.
|
boolean |
offer(boolean elem) |
boolean |
offerFirst(boolean elem) |
boolean |
offerLast(boolean elem) |
boolean |
peek() |
boolean |
peekFirst() |
boolean |
peekLast() |
boolean |
poll() |
boolean |
pollFirst() |
boolean |
pollLast() |
boolean |
pop() |
void |
push(boolean elem) |
boolean |
remove() |
boolean |
remove(int index) |
void |
remove(int index,
int len)
Remove specified range of elements from list.
|
boolean |
removeAll(BooleanGapList coll) |
boolean |
removeAll(java.util.Collection<java.lang.Boolean> coll) |
boolean |
removeFirst() |
boolean |
removeFirstOccurrence(boolean elem) |
boolean |
removeLast() |
boolean |
removeLastOccurrence(boolean elem) |
void |
resize(int len,
boolean elem)
Resizes the list so it will afterwards have a size of
len. |
boolean |
retainAll(BooleanGapList coll) |
boolean |
retainAll(java.util.Collection<java.lang.Boolean> 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.
|
boolean |
set(int index,
boolean elem) |
void |
setAll(int index,
boolean... elems)
Replaces the specified elements.
|
void |
setAll(int index,
BooleanGapList list)
Replaces the specified elements.
|
void |
setAll(int index,
java.util.Collection<java.lang.Boolean> 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(BooleanGapList src,
int srcIndex,
BooleanGapList 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.
|
boolean[] |
toArray() |
boolean[] |
toArray(boolean[] array) |
boolean[] |
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 BooleanGapList instance to be the
list's current size.
|
BooleanGapList |
unmodifiableList()
Returns an unmodifiable view of this list.
|
public BooleanGapList()
public BooleanGapList(int capacity)
capacity - capacitypublic BooleanGapList(java.util.Collection<java.lang.Boolean> coll)
coll - collection with elementspublic BooleanGapList(boolean... elems)
elems - array with elementspublic static BooleanGapList EMPTY()
public static BooleanGapList create()
type - of elements stored in the listpublic static BooleanGapList create(int capacity)
capacity - capacitytype - of elements stored in the listpublic static BooleanGapList create(java.util.Collection<java.lang.Boolean> coll)
coll - collection with elementtype - of elements stored in the listpublic static BooleanGapList create(boolean... 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.Boolean> coll)
coll - collection with elementspublic void init(boolean... elems)
elems - array with elementspublic BooleanGapList copy()
clone()public BooleanGapList unmodifiableList()
public java.lang.Object clone()
clone in class java.lang.Objectpublic void clear()
public int size()
public int capacity()
public boolean get(int index)
public boolean set(int index,
boolean elem)
public boolean add(boolean elem)
public void add(int index,
boolean elem)
public boolean 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(boolean elem)
public int lastIndexOf(boolean elem)
public boolean contains(boolean elem)
public boolean containsAny(java.util.Collection<java.lang.Boolean> coll)
coll - collection with elements to be containedpublic boolean containsAll(java.util.Collection<java.lang.Boolean> coll)
public boolean removeAll(java.util.Collection<java.lang.Boolean> coll)
public boolean removeAll(BooleanGapList coll)
removeAll(Collection)public boolean retainAll(java.util.Collection<java.lang.Boolean> coll)
public boolean retainAll(BooleanGapList coll)
retainAll(Collection)public boolean[] toArray()
public boolean[] toArray(int index,
int len)
index - index of first element to copylen - number of elements to copypublic boolean[] toArray(boolean[] array)
public boolean addAll(java.util.Collection<java.lang.Boolean> coll)
coll - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is (boolean)falsepublic boolean addAll(int index,
java.util.Collection<java.lang.Boolean> 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 (boolean)falsepublic boolean addAll(boolean... elems)
elems - elements to be added to this listpublic boolean addAll(int index,
boolean... 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(BooleanGapList list)
list - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified list is (boolean)falsepublic boolean addAll(int index,
BooleanGapList 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 (boolean)falsepublic boolean peek()
public boolean element()
public boolean poll()
public boolean remove()
public boolean offer(boolean elem)
public boolean getFirst()
public boolean getLast()
public void addFirst(boolean elem)
public void addLast(boolean elem)
public boolean removeFirst()
public boolean removeLast()
public boolean offerFirst(boolean elem)
public boolean offerLast(boolean elem)
public boolean peekFirst()
public boolean peekLast()
public boolean pollFirst()
public boolean pollLast()
public boolean pop()
public void push(boolean elem)
public boolean removeFirstOccurrence(boolean elem)
public boolean removeLastOccurrence(boolean elem)
public static void move(BooleanGapList src, int srcIndex, BooleanGapList 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(BooleanGapList src, int srcIndex, BooleanGapList 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(BooleanGapList src, int srcIndex, BooleanGapList 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 BooleanGapList getAll(int index, int len)
index - index of first element to retrievelen - number of elements to retrievepublic boolean[] getArray(int index,
int len)
index - index of first element to retrievelen - number of elements to retrievepublic void setAll(int index,
BooleanGapList list)
index - index of first element to setlist - list with elements to setpublic void setAll(int index,
java.util.Collection<java.lang.Boolean> coll)
index - index of first element to setcoll - collection with elements to setpublic void setAll(int index,
boolean... 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,
boolean 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,
boolean 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(boolean elem)
elem - element used for fillingpublic void fill(int index,
int len,
boolean 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
((boolean)false 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
((boolean)false means the elements natural ordering should be used)Arrays.sort(int[])public int binarySearch(boolean key)
key - the value to be searched forcomparator - the comparator by which the list is ordered.
A (boolean)false value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)public int binarySearch(int index,
int len,
boolean 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 (boolean)false value indicates that the elements'
natural ordering should be used.Arrays.binarySearch(long[], long)