PathMultimap

interface PathMultimap<out T>(source)

Multimap implementation mapping paths to values of type T.

It is a multimap in the sense that multiple values may be associated with the same path. However, each entry in the multimap is represented by an id PathMultimapEntryId and the multimap allows operations on said ids.

Operations on the multimap that receive paths follow the path semantics of matching (for contains, get, and entries). This allows us to, for example, get all values matching a certain path that contains wildcards; or to have entries containing paths with wildcards in the multimap whose value will be returned when getting a path without wildcards that matches it.

Inheritors

Properties

Link copied to clipboard

Sequence of all entries in the multimap (may have repeated entries).

Link copied to clipboard
abstract val size: Int

Number of entries in the multimap.

Link copied to clipboard
open val values: Sequence<T>

Sequence of values in the multimap (may have repeated values).

Functions

Link copied to clipboard
open operator fun contains(value: @UnsafeVariance T): Boolean

Returns whether there exists at least one value equal to value in the multimap. Equivalent to containsValue(value).

open operator fun contains(entryId: PathMultimapEntryId): Boolean

Returns whether there exists an entry identified by entryId in the multimap. Equivalent to containsEntry(entryId).

open operator fun contains(path: String): Boolean
open operator fun contains(path: Path): Boolean

Returns whether there exists at least one entry with a path matching path (following the semantics of path matching). Equivalent to containsPath(path).

Link copied to clipboard
abstract fun containsEntry(entryId: PathMultimapEntryId): Boolean

Returns whether there exists an entry identified by entryId in the multimap.

Link copied to clipboard
open fun containsPath(path: String): Boolean
abstract fun containsPath(path: Path): Boolean

Returns whether there exists at least one entry with a path matching path (following the semantics of path matching).

Link copied to clipboard
abstract fun containsValue(value: @UnsafeVariance T): Boolean

Returns whether there exists at least one value equal to value in the multimap.

Link copied to clipboard
abstract fun entries(path: Path = AbsolutePath.MATCH_ALL): Sequence<PathMultimapEntry<T>>

Returns a sequence over all entries with a path matching path (following the semantics of path matching).

Link copied to clipboard
open operator fun get(entryId: PathMultimapEntryId): PathMultimapEntry<T>?

Returns the entry identified by entryId or null when no such entry exists. Equivalent to getEntry(entryId).

open operator fun get(path: String): Sequence<T>
abstract operator fun get(path: Path): Sequence<T>

Returns a sequence over all values with a path matching path (following the semantics of path matching).

Link copied to clipboard

Returns the entry identified by entryId or null when no such entry exists.

Link copied to clipboard
open fun getOne(path: String): T?
open fun getOne(path: Path): T?

Returns one value matching path or null when no such value exists. Equivalent to get(path).firstOrNull().

Link copied to clipboard
open fun isEmpty(): Boolean

Whether the multimap is empty.

Link copied to clipboard

Transforms the multimap into a mapping of paths to lists of values associated with them.