public final class DefaultPartitionAttributesBuilder extends java.lang.Object implements PartitionAttributesBuilder
PartitionAttributesBuilder
.
This class provides a relatively low memory overhead (when compared to TreeMap
) for a
PartitionAttributes
. The goals are to provide fast Object.equals(Object)
and
Object.hashCode()
which do not require intermediate object allocation and pointer traversal
(e.g. Iterator
).
Constructor and Description |
---|
DefaultPartitionAttributesBuilder(int initialSize)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
<T> PartitionAttributesBuilder |
add(PartitionAttributes.Key<T> key,
T value)
Add a key/value pair to this builder.
|
PartitionAttributes |
build()
Build a
PartitionAttributes corresponding to the previous PartitionAttributesBuilder.add(PartitionAttributes.Key, Object)
calls. |
public DefaultPartitionAttributesBuilder(int initialSize)
initialSize
- The anticipated number of key/value pairs that will be added via
add(Key<T> key, T value)
.public <T> PartitionAttributesBuilder add(PartitionAttributes.Key<T> key, T value)
PartitionAttributesBuilder
Duplicate keys are not necessarily detected, and this will instead just add.
add
in interface PartitionAttributesBuilder
T
- The value type.key
- The key.value
- The value.this
.public PartitionAttributes build()
PartitionAttributesBuilder
PartitionAttributes
corresponding to the previous PartitionAttributesBuilder.add(PartitionAttributes.Key, Object)
calls.build
in interface PartitionAttributesBuilder
PartitionAttributes
corresponding to the previous PartitionAttributesBuilder.add(PartitionAttributes.Key, Object)
calls.