ChunkMap

zio.blocks.chunk.ChunkMap
See theChunkMap companion class
object ChunkMap extends MapFactory[ChunkMap]

Attributes

Companion
class
Source
ChunkMap.scala
Graph
Supertypes
trait MapFactory[ChunkMap]
trait Serializable
class Object
trait Matchable
class Any
Self type
ChunkMap.type

Members list

Type members

Classlikes

final class ChunkMapBuilder[K, V](initCapacity: Int = ...) extends Builder[(K, V), ChunkMap[K, V]]

A mutable builder for constructing instances of ChunkMap.

A mutable builder for constructing instances of ChunkMap.

This builder allows efficient assembly of a ChunkMap by enabling progressive addition of key-value pairs. Duplicate keys are supported; in case of duplicates, the latest associated value overwrites the previous value.

Type parameters

K

The type of keys in the map.

V

The type of values in the map.

Value parameters

initCapacity

The initial capacity for the internal storage of keys and values. Defaults to 4 if not explicitly provided. Methods:

  • addOne: Adds a single key-value pair to the map being built.
  • clear: Clears all key-value pairs from the builder, resetting its state.
  • knownSize: Returns the current size of the map being built.
  • result: Finalizes the construction and produces an immutable ChunkMap instance.
  • sizeHint: Provides a size hint to optimize internal storage for a specified number of elements.

Attributes

Constructor

Initializes the builder with a specified initial capacity for internal buffers.

Source
ChunkMap.scala
Supertypes
trait Builder[(K, V), ChunkMap[K, V]]
trait Growable[(K, V)]
trait Clearable
class Object
trait Matchable
class Any
Show all
final class Indexed[K, +V](val underlying: ChunkMap[K, V]) extends AbstractMap[K, V], Serializable

Represents an immutable map with indexed access, implemented on top of a ChunkMap.

Represents an immutable map with indexed access, implemented on top of a ChunkMap.

This class provides efficient indexed access to keys and values within the underlying ChunkMap, while also exposing standard map operations. Internally, it maintains an index for fast key lookup.

Type parameters

K

the type of keys in the map

V

the type of values in the map

Value parameters

underlying

the ChunkMap serving as the backing storage for the map

Attributes

Constructor

Creates a new Indexed map from the given ChunkMap.

Source
ChunkMap.scala
Supertypes
trait Serializable
class AbstractMap[K, V]
trait Map[K, V]
trait MapOps[K, V, Map, Map[K, V]]
trait Iterable[(K, V)]
class AbstractMap[K, V]
trait Map[K, V]
trait Pure
trait Equals
trait MapFactoryDefaults[K, V, Map, Iterable]
trait MapOps[K, V, Map, Map[K, V]]
trait PartialFunction[K, V]
trait K => V
class AbstractIterable[(K, V)]
trait Iterable[(K, V)]
trait IterableFactoryDefaults[(K, V), Iterable]
trait IterableOps[(K, V), Iterable, Map[K, V]]
trait IterableOnceOps[(K, V), Iterable, Map[K, V]]
trait IterableOnce[(K, V)]
class Object
trait Matchable
class Any
Show all

Value members

Concrete methods

override def apply[K, V](elems: (K, V)*): ChunkMap[K, V]

Constructs a ChunkMap from a sequence of key-value pairs.

Constructs a ChunkMap from a sequence of key-value pairs.

Attributes

Definition Classes
MapFactory
Source
ChunkMap.scala
def empty[K, V]: ChunkMap[K, V]

Returns an empty instance of ChunkMap.

Returns an empty instance of ChunkMap.

Attributes

Source
ChunkMap.scala
override def from[K, V](it: IterableOnce[(K, V)]): ChunkMap[K, V]

Constructs a ChunkMap from an IterableOnce of key-value pairs.

Constructs a ChunkMap from an IterableOnce of key-value pairs.

Attributes

Definition Classes
MapFactory
Source
ChunkMap.scala
def fromChunk[K, V](chunk: Chunk[(K, V)]): ChunkMap[K, V]

Creates a ChunkMap from a Chunk of key-value pairs, handling duplicate keys by keeping the last value for each key (preserving the position of the first occurrence).

Creates a ChunkMap from a Chunk of key-value pairs, handling duplicate keys by keeping the last value for each key (preserving the position of the first occurrence).

Attributes

Source
ChunkMap.scala
def fromChunks[K, V](keys: Chunk[K], values: Chunk[V]): ChunkMap[K, V]

Creates a ChunkMap from parallel Chunks of keys and values.

Creates a ChunkMap from parallel Chunks of keys and values.

Precondition: The keys must not contain duplicate elements. If duplicate keys are present, the behavior is undefined (lookups may return any of the duplicate values). Use from() or the builder if duplicate handling is needed.

Attributes

Throws
java.lang.IllegalArgumentException

if keys and values have different lengths

Source
ChunkMap.scala
override def newBuilder[K, V]: Builder[(K, V), ChunkMap[K, V]]

Creates a new builder for constructing a ChunkMap from key-value pairs.

Creates a new builder for constructing a ChunkMap from key-value pairs.

Attributes

Definition Classes
MapFactory
Source
ChunkMap.scala

Implicits

Inherited implicits

implicit def mapFactory[K, V]: Factory[(K, V), ChunkMap[K, V]]

The default Factory instance for maps.

The default Factory instance for maps.

Type parameters

K

the type of the keys

V

the type of the values

Attributes

Inherited from:
MapFactory
Source
Factory.scala