Package com.luciad.util.collections
Class TLcdBooleanArrayList
- All Implemented Interfaces:
ILcdBooleanList
,ILcdCloneable
,Cloneable
,Iterable<Boolean>
,Collection<Boolean>
,List<Boolean>
,SequencedCollection<Boolean>
public class TLcdBooleanArrayList
extends AbstractList<Boolean>
implements Cloneable, ILcdBooleanList
Array-based implementation of
ILcdBooleanList
.- Since:
- 9.0
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionCreates a new, emptyTLcdBooleanArrayList
.TLcdBooleanArrayList
(int aInitialCapacity) Creates a new, emptyTLcdBooleanArrayList
with the specified initial capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
addAll
(int aIndex, boolean[] aValues, int aOffset, int aLength) AddsaLength
boolean values from the given array to this list, starting from the givenaOffset
boolean
addAll
(int index, Collection<? extends Boolean> c) boolean
addAll
(Collection<? extends Boolean> c) boolean
addBoolean
(boolean aValue) Appends the specified value to the end of this list (optional operation).void
addBoolean
(int aIndex, boolean aValue) Inserts the specified value at the specified position in this list (optional operation).void
clear()
clone()
Creates and returns a copy of this object.boolean
boolean
containsBoolean
(boolean aValue) Returnstrue
if this list contains the specified value.void
ensureCapacity
(int minCapacity) Increases the capacity of this list to the specified capacity.get
(int index) boolean
getBoolean
(int aIndex) Returns the value at the specified position in this list.int
int
indexOfBoolean
(boolean aValue) Returns the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value.int
lastIndexOf
(Object aO) int
lastIndexOfBoolean
(boolean aValue) Returns the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value.remove
(int index) boolean
removeBoolean
(boolean aValue) Removes the first occurrence of the specified value from this list, if it is present (optional operation).boolean
removeBoolean
(int aIndex) Removes the value at the specified position in this list (optional operation).boolean
setBoolean
(int aIndex, boolean aValue) Replaces the value at the specified position in this list with the specified value (optional operation).int
size()
boolean[]
Returns an array containing all of the values in this list in proper sequence (from first to last value).boolean[]
toBooleanArray
(boolean[] anArray) Returns an array containing all of the values in this list in proper sequence (from first to last value); If the list fits in the specified array, t is returned therein.void
Trims the internal data array of this list to match the size of this list.Methods inherited from class java.util.AbstractList
add, equals, hashCode, iterator, listIterator, listIterator, removeRange, subList
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface com.luciad.util.collections.ILcdBooleanList
addAll, addAll, addAll
Methods inherited from interface java.util.List
add, addFirst, addLast, containsAll, equals, getFirst, getLast, hashCode, isEmpty, iterator, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Constructor Details
-
TLcdBooleanArrayList
public TLcdBooleanArrayList()Creates a new, emptyTLcdBooleanArrayList
. -
TLcdBooleanArrayList
public TLcdBooleanArrayList(int aInitialCapacity) Creates a new, emptyTLcdBooleanArrayList
with the specified initial capacity.- Parameters:
aInitialCapacity
- the initial capacity of this list.
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceCollection<Boolean>
- Specified by:
size
in interfaceList<Boolean>
- Specified by:
size
in classAbstractCollection<Boolean>
-
get
-
set
-
add
-
addAll
- Specified by:
addAll
in interfaceCollection<Boolean>
- Specified by:
addAll
in interfaceList<Boolean>
- Overrides:
addAll
in classAbstractCollection<Boolean>
-
addAll
-
addAll
public boolean addAll(int aIndex, boolean[] aValues, int aOffset, int aLength) Description copied from interface:ILcdBooleanList
AddsaLength
boolean values from the given array to this list, starting from the givenaOffset
- Specified by:
addAll
in interfaceILcdBooleanList
- Parameters:
aIndex
- The position in this list where to start inserting the given boolean values.aValues
- The array containing the boolean values to add to this listaOffset
- The offset inaValues
from where to start copying the boolean valuesaLength
- The number of boolean values to copy fromaValues
to this list.- Returns:
- Whether this list was modified as a result of this call.
-
remove
-
getBoolean
public boolean getBoolean(int aIndex) Description copied from interface:ILcdBooleanList
Returns the value at the specified position in this list.- Specified by:
getBoolean
in interfaceILcdBooleanList
- Parameters:
aIndex
- index of the value to return- Returns:
- the value at the specified position in this list
-
setBoolean
public boolean setBoolean(int aIndex, boolean aValue) Description copied from interface:ILcdBooleanList
Replaces the value at the specified position in this list with the specified value (optional operation).- Specified by:
setBoolean
in interfaceILcdBooleanList
- Parameters:
aIndex
- index of the value to replaceaValue
- value to be stored at the specified position- Returns:
- the value previously at the specified position
-
addBoolean
public boolean addBoolean(boolean aValue) Description copied from interface:ILcdBooleanList
Appends the specified value to the end of this list (optional operation).- Specified by:
addBoolean
in interfaceILcdBooleanList
- Parameters:
aValue
- value to be appended to this list- Returns:
true
-
addBoolean
public void addBoolean(int aIndex, boolean aValue) Description copied from interface:ILcdBooleanList
Inserts the specified value at the specified position in this list (optional operation). Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices).- Specified by:
addBoolean
in interfaceILcdBooleanList
- Parameters:
aIndex
- index at which the specified value is to be insertedaValue
- value to be inserted
-
removeBoolean
public boolean removeBoolean(boolean aValue) Description copied from interface:ILcdBooleanList
Removes the first occurrence of the specified value from this list, if it is present (optional operation). If this list does not contain the value, it is unchanged. Returnstrue
if this list contained the specified value (or equivalently, if this list changed as a result of the call).- Specified by:
removeBoolean
in interfaceILcdBooleanList
- Parameters:
aValue
- value to be removed from this list, if present- Returns:
true
if this list contained the specified value
-
removeBoolean
public boolean removeBoolean(int aIndex) Description copied from interface:ILcdBooleanList
Removes the value at the specified position in this list (optional operation). Shifts any subsequent values to the left (subtracts one from their indices). Returns the value that was removed from the list.- Specified by:
removeBoolean
in interfaceILcdBooleanList
- Parameters:
aIndex
- the index of the value to be removed- Returns:
- the value previously at the specified position
-
toBooleanArray
public boolean[] toBooleanArray()Description copied from interface:ILcdBooleanList
Returns an array containing all of the values in this list in proper sequence (from first to last value). The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array even if this list is backed by an array). The caller is thus free to modify the returned array.- Specified by:
toBooleanArray
in interfaceILcdBooleanList
- Returns:
- an array containing all of the values in this list in proper sequence
-
toBooleanArray
public boolean[] toBooleanArray(boolean[] anArray) Description copied from interface:ILcdBooleanList
Returns an array containing all of the values in this list in proper sequence (from first to last value); If the list fits in the specified array, t is returned therein. Otherwise, a new array is allocated with the size of this list. If the list fits in the specified array with room to spare (i.e., the array has more values than the list), the value in the array immediately following the end of the list is set to 0. (This is useful in determining the length of the list only if the caller knows that the list does not contain any 0 values.)- Specified by:
toBooleanArray
in interfaceILcdBooleanList
- Parameters:
anArray
- the array into which the values of this list are to be stored, if it is big enough; otherwise, a new array is allocated for this purpose.- Returns:
- an array containing the values of this list
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<Boolean>
- Specified by:
clear
in interfaceList<Boolean>
- Overrides:
clear
in classAbstractList<Boolean>
-
clone
Description copied from interface:ILcdBooleanList
Creates and returns a copy of this object.- Specified by:
clone
in interfaceILcdBooleanList
- Specified by:
clone
in interfaceILcdCloneable
- Overrides:
clone
in classObject
- Returns:
- a copy of this object.
- See Also:
-
ensureCapacity
public void ensureCapacity(int minCapacity) Increases the capacity of this list to the specified capacity. This method has no effect if the specified capacity is smaller than the current capacity.- Parameters:
minCapacity
- the new capacity for this list.
-
trimToSize
public void trimToSize()Trims the internal data array of this list to match the size of this list. -
indexOf
-
indexOfBoolean
public int indexOfBoolean(boolean aValue) Description copied from interface:ILcdBooleanList
Returns the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value.- Specified by:
indexOfBoolean
in interfaceILcdBooleanList
- Parameters:
aValue
- value to search for- Returns:
- the index of the first occurrence of the specified value in this list, or -1 if this list does not contain the value
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<Boolean>
- Overrides:
lastIndexOf
in classAbstractList<Boolean>
-
lastIndexOfBoolean
public int lastIndexOfBoolean(boolean aValue) Description copied from interface:ILcdBooleanList
Returns the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value.- Specified by:
lastIndexOfBoolean
in interfaceILcdBooleanList
- Parameters:
aValue
- value to search for- Returns:
- the index of the last occurrence of the specified value in this list, or -1 if this list does not contain the value
-
containsBoolean
public boolean containsBoolean(boolean aValue) Description copied from interface:ILcdBooleanList
Returnstrue
if this list contains the specified value.- Specified by:
containsBoolean
in interfaceILcdBooleanList
- Parameters:
aValue
- value whose presence in this list is to be tested- Returns:
true
if this list contains the specified value
-
contains
- Specified by:
contains
in interfaceCollection<Boolean>
- Specified by:
contains
in interfaceList<Boolean>
- Overrides:
contains
in classAbstractCollection<Boolean>
-