Class DefaultPartitionAttributesBuilder
- java.lang.Object
-
- io.servicetalk.client.api.internal.partition.DefaultPartitionAttributesBuilder
-
- All Implemented Interfaces:
PartitionAttributesBuilder
public final class DefaultPartitionAttributesBuilder extends java.lang.Object implements PartitionAttributesBuilder
Default implementation ofPartitionAttributesBuilder.This class provides a relatively low memory overhead (when compared to
TreeMap) for aPartitionAttributes. The goals are to provide fastObject.equals(Object)andObject.hashCode()which do not require intermediate object allocation and pointer traversal (e.g.Iterator).
-
-
Constructor Summary
Constructors Constructor Description DefaultPartitionAttributesBuilder(int initialSize)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> PartitionAttributesBuilderadd(PartitionAttributes.Key<T> key, T value)Add a key/value pair to this builder.PartitionAttributesbuild()Build aPartitionAttributescorresponding to the previousPartitionAttributesBuilder.add(PartitionAttributes.Key, Object)calls.
-
-
-
Constructor Detail
-
DefaultPartitionAttributesBuilder
public DefaultPartitionAttributesBuilder(int initialSize)
Create a new instance.- Parameters:
initialSize- The anticipated number of key/value pairs that will be added viaadd(Key<T> key, T value).
-
-
Method Detail
-
add
public <T> PartitionAttributesBuilder add(PartitionAttributes.Key<T> key, T value)
Description copied from interface:PartitionAttributesBuilderAdd a key/value pair to this builder.Duplicate keys are not necessarily detected, and this will instead just add.
- Specified by:
addin interfacePartitionAttributesBuilder- Type Parameters:
T- The value type.- Parameters:
key- The key.value- The value.- Returns:
this.
-
build
public PartitionAttributes build()
Description copied from interface:PartitionAttributesBuilderBuild aPartitionAttributescorresponding to the previousPartitionAttributesBuilder.add(PartitionAttributes.Key, Object)calls.- Specified by:
buildin interfacePartitionAttributesBuilder- Returns:
- a
PartitionAttributescorresponding to the previousPartitionAttributesBuilder.add(PartitionAttributes.Key, Object)calls.
-
-