BitSet, except for very small sizes. It more CPU efficient than BitSet, except for very large
sizes or if BitSet functionality such as and, or, xor, etc are needed. If unordered, this class avoids a memory copy when
removing elements (the last element is moved to the removed element's position).
| Modifier and Type | Field and Description |
|---|---|
| public boolean[] | |
| public boolean | |
| public int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | BooleanArray(boolean
If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy. ordered, int Any elements added beyond this will cause the backing array to be grown. capacity)
|
| public | |
| public | BooleanArray(boolean[] array)
Creates a new ordered array containing the elements in the specified array. |
| public | BooleanArray(boolean
If false, methods that remove elements may change the order of other elements in the array, which avoids a
memory copy. ordered, boolean[] array, int startIndex, int count)Creates a new array containing the elements in the specified array. |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public boolean[] | Returns: itemsIncreases the size of the backing array to accommodate the specified number of additional items. |
| public boolean | |
| public boolean | |
| public boolean | |
| public int | |
| public void | |
| public void | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: true if this array was modified.Removes from this array the first instance of each element contained in the specified array. |
| public boolean | |
| public void | |
| public int | Returns: the number of replacements donethe boolean to be replaced value, boolean all occurrences of value will be replaced by this replacement replacement)Returns the number of replacements done. |
| public boolean | Returns: if value was found and replacedthe boolean to be replaced value, boolean the first value will be replaced by this replacement if found replacement)Returns true if the specified value was replaced successfully with the replacement |
| protected boolean[] | |
| public void | |
| public void | |
| public boolean[] | |
| public boolean[] | |
| public void | |
| public void | |
| public boolean[] | |
| public String | |
| public String | |
| public void | |
| public static BooleanArray |
| items | back to summary |
|---|---|
| public boolean[] items | |
| ordered | back to summary |
|---|---|
| public boolean ordered | |
| size | back to summary |
|---|---|
| public int size | |
| BooleanArray | back to summary |
|---|---|
| public BooleanArray() Creates an ordered array with a capacity of 16. | |
| BooleanArray | back to summary |
|---|---|
| public BooleanArray(int capacity) Creates an ordered array with the specified capacity. | |
| BooleanArray | back to summary |
|---|---|
public BooleanArray(boolean ordered, int capacity)
| |
| BooleanArray | back to summary |
|---|---|
| public BooleanArray(BooleanArray array) Creates a new array containing the elements in the specific array. The new array will be ordered if the specific array is ordered. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be grown. | |
| BooleanArray | back to summary |
|---|---|
| public BooleanArray(boolean[] array) Creates a new ordered array containing the elements in the specified array. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be grown. | |
| BooleanArray | back to summary |
|---|---|
| public BooleanArray(boolean ordered, boolean[] array, int startIndex, int count) Creates a new array containing the elements in the specified array. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array to be grown.
| |
| add | back to summary |
|---|---|
| public void add(boolean value) | |
| add | back to summary |
|---|---|
| public void add(boolean value1, boolean value2) | |
| add | back to summary |
|---|---|
| public void add(boolean value1, boolean value2, boolean value3) | |
| add | back to summary |
|---|---|
| public void add(boolean value1, boolean value2, boolean value3, boolean value4) | |
| addAll | back to summary |
|---|---|
| public void addAll(BooleanArray array) | |
| addAll | back to summary |
|---|---|
| public void addAll(BooleanArray array, int offset, int length) | |
| addAll | back to summary |
|---|---|
| public void addAll(boolean... array) | |
| addAll | back to summary |
|---|---|
| public void addAll(boolean[] array, int offset, int length) | |
| clear | back to summary |
|---|---|
| public void clear() | |
| ensureCapacity | back to summary |
|---|---|
| public boolean[] ensureCapacity(int additionalCapacity) Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many items to avoid multiple backing array resizes.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Returns false if either array is unordered. | |
| first | back to summary |
|---|---|
| public boolean first() Returns the first item. | |
| get | back to summary |
|---|---|
| public boolean get(int index) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| insert | back to summary |
|---|---|
| public void insert(int index, boolean value) | |
| insertRange | back to summary |
|---|---|
| public void insertRange(int index, int count) Inserts the specified number of items at the specified index. The new items will have values equal to the values at those indices before the insertion. | |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Returns true if the array is empty. | |
| notEmpty | back to summary |
|---|---|
| public boolean notEmpty() Returns true if the array has one or more items. | |
| peek | back to summary |
|---|---|
| public boolean peek() Returns the last item. | |
| pop | back to summary |
|---|---|
| public boolean pop() Removes and returns the last item. | |
| random | back to summary |
|---|---|
| public boolean random() Returns a random item from the array, or false if the array is empty. | |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(BooleanArray array) Removes from this array the first instance of each element contained in the specified array.
| |
| removeIndex | back to summary |
|---|---|
| public boolean removeIndex(int index) Removes and returns the item at the specified index. | |
| removeRange | back to summary |
|---|---|
| public void removeRange(int start, int end) Removes the items between the specified indices, inclusive. | |
| replaceAll | back to summary |
|---|---|
| public int replaceAll(boolean value, boolean replacement) Returns the number of replacements done.
| |
| replaceFirst | back to summary |
|---|---|
| public boolean replaceFirst(boolean value, boolean replacement) Returns true if the specified value was replaced successfully with the replacement
| |
| resize | back to summary |
|---|---|
| protected boolean[] resize(int newSize) | |
| reverse | back to summary |
|---|---|
| public void reverse() | |
| set | back to summary |
|---|---|
| public void set(int index, boolean value) | |
| setSize | back to summary |
|---|---|
| public boolean[] setSize(int newSize) Sets the array size, leaving any values beyond the current size undefined.
| |
| shrink | back to summary |
|---|---|
| public boolean[] shrink() Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items have been removed, or if it is known that more items will not be added.
| |
| shuffle | back to summary |
|---|---|
| public void shuffle() | |
| swap | back to summary |
|---|---|
| public void swap(int first, int second) | |
| toArray | back to summary |
|---|---|
| public boolean[] toArray() | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| toString | back to summary |
|---|---|
| public String toString(String separator) | |
| truncate | back to summary |
|---|---|
| public void truncate(int newSize) Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is taken. | |
| with | back to summary |
|---|---|
public static BooleanArray with(boolean... array)
| |