TransformingObjectSet

class TransformingObjectSet<O, M>(fromSet: ObjectSet<O>, toTransformer: (O) -> M?, fromTransformer: (M) -> O?) : ObjectSet<M>

A specialized implementation of ObjectSet that transforms elements between two types, O and M, using the provided transformation functions. This enables a dynamic view of a set where elements are transformed on-the-fly during iteration or when performing operations.

Parameters

O

The type of the elements in the underlying set.

M

The type of the transformed elements in this set.

Constructors

Link copied to clipboard
constructor(fromSet: ObjectSet<O>, toTransformer: (O) -> M?, fromTransformer: (M) -> O?)

Properties

Link copied to clipboard
open override val size: Int

Returns the number of elements in the transformed set.

Functions

Link copied to clipboard
open override fun add(element: M?): Boolean

Adds a transformed element to the underlying set.

Link copied to clipboard
open override fun addAll(elements: Collection<M?>): Boolean

Adds all transformed elements from the given collection to the underlying set.

Link copied to clipboard
open override fun clear()

Removes all elements from the underlying set.

Link copied to clipboard
Link copied to clipboard
open operator override fun contains(element: M?): Boolean

Checks if the transformed set contains the specified element.

Link copied to clipboard
open override fun containsAll(elements: Collection<M?>): Boolean

Checks if the transformed set contains all elements in the specified collection.

Link copied to clipboard
fun <T> ObjectSet<T>.freeze(): @UnmodifiableView ObjectSet<T>
Link copied to clipboard
open override fun isEmpty(): Boolean

Checks if the transformed set is empty.

Link copied to clipboard
open operator override fun iterator(): ObjectIterator<M>

Returns an iterator that transforms elements from the underlying set during iteration.

Link copied to clipboard
fun <E> Iterable<E>.joinToComponent(formatter: (E) -> Component): Component
Link copied to clipboard
fun <E> Iterable<E>.joinToComponentNewLine(linePrefix: Component = PREFIX, formatter: (E) -> Component): Component
Link copied to clipboard
open override fun remove(element: M): Boolean

Removes a transformed element from the underlying set.

Link copied to clipboard
open override fun removeAll(elements: Collection<M?>): Boolean

Removes all transformed elements in the given collection from the underlying set.

Link copied to clipboard
open override fun retainAll(elements: Collection<M?>): Boolean

Retains only the transformed elements in the given collection in the underlying set.

Link copied to clipboard
open override fun spliterator(): ObjectSpliterator<M>
Link copied to clipboard
fun <T> ObjectSet<T>.synchronize(): ObjectSet<T>
Link copied to clipboard
fun <T> Collection<T>.toObjectList(): ObjectList<T>
fun <T> Iterable<T>.toObjectList(): ObjectList<T>
Link copied to clipboard
fun <T> Iterable<T>.toObjectSet(): ObjectSet<T>