- class
ArrayBag
(T): BagCollection!(T);
- Linked Buffer implementation of Bags. The Bag consists of
any number of buffers holding elements, arranged in a list.
Each buffer holds an array of elements. The size of each
buffer is the value of chunkSize that was current during the
operation that caused the Bag to grow. The chunkSize() may
be adjusted at any time. (It is not considered a version change.)
All but the final buffer is always kept full.
When a buffer has no elements, it is released (so is
available for garbage collection).
ArrayBags are good choices for collections in which
you merely put a lot of things in, and then look at
them via enumerations, but don't often look for
particular elements.
author:
Doug Lea
@version 0.93
For an introduction to this package see Overview .
- int
defaultChunkSize
;
- The default chunk size to use for buffers
- CLCellT
tail
;
- The last node of the circular list of chunks. Null if empty.
- int
lastCount
;
- The number of elements of the tail node actually used. (all others
are kept full).
- int
chunkSize_
;
- The chunk size to use for making next buffer
- this();
- Make an empty buffer.
- this(Predicate s);
- Make an empty buffer, using the supplied element screener.
- this(Predicate s, int n, CLCellT t, int lc, int cs);
- Special version of constructor needed by clone()
- ArrayBag!(T)
duplicate
();
- Make an independent copy. Does not clone elements.
- int
chunkSize
();
- Report the chunk size used when adding new buffers to the list
- void
chunkSize
(int newChunkSize);
- Set the chunk size to be used when adding new buffers to the
list during future add() operations.
Any value greater than 0 is OK. (A value of 1 makes this a
into very slow simulation of a linked list!)
- bool
contains
(T element);
- Implements tango.util.collection.impl.Collection.Collection.
contains
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.Collection.
contains
- uint
instances
(T element);
- Implements tango.util.collection.impl.Collection.Collection.
instances
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.
instances
- GuardIterator!(T)
elements
();
- Implements tango.util.collection.impl.Collection.Collection.
elements
Time complexity: O(1).
See Also:
tango.util.collection.impl.Collection.Collection.
elements
- int
opApply
(int delegate(ref T value) dg);
- Implements tango.util.collection.model.View.View.
opApply
Time complexity: O(n).
See Also:
tango.util.collection.model.View.View.
opApply
- void
clear
();
- Implements tango.util.collection.impl.Collection.Collection.
clear
.
Time complexity: O(1).
See Also:
tango.util.collection.impl.Collection.Collection.
clear
- void
removeAll
(T element);
- Implements tango.util.collection.impl.Collection.Collection.
removeAll
.
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.Collection.
removeAll
- void
remove
(T element);
- Implements tango.util.collection.impl.Collection.Collection.removeOneOf.
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.Collection.removeOneOf
- void
replace
(T oldElement, T newElement);
- Implements tango.util.collection.impl.Collection.Collection.replaceOneOf
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.Collection.replaceOneOf
- void
replaceAll
(T oldElement, T newElement);
- Implements tango.util.collection.impl.Collection.Collection.replaceAllOf.
Time complexity: O(n).
See Also:
tango.util.collection.impl.Collection.Collection.replaceAllOf
- T
take
();
- Implements tango.util.collection.impl.Collection.Collection.
take
.
Time complexity: O(1).
Takes the least element.
See Also:
tango.util.collection.impl.Collection.Collection.
take
- void
addIf
(T element);
- Implements tango.util.collection.MutableBag.addIfAbsent.
Time complexity: O(n).
See Also:
tango.util.collection.MutableBag.addIfAbsent
- void
add
(T element);
- Implements tango.util.collection.MutableBag.
add
.
Time complexity: O(1).
See Also:
tango.util.collection.MutableBag.
add
- void
remove_
(T element, bool allOccurrences);
- helper for remove/exclude
- void
checkImplementation
();
- Implements tango.util.collection.model.View.View.
checkImplementation
.
See Also:
tango.util.collection.model.View.View.
checkImplementation
- template
ArrayIterator
(T)
- opApply() has migrated here to mitigate the virtual call
on method get()
|