InstanceTracker

abstract class InstanceTracker<T>(setCreator: () -> MutableSet<T>? = null)

A generic Set for tracking object instances.

This class is designed to augment a normal Set by allowing overriding implementations to customize tracking behavior, such as to implement AutoCloseable for automatic resource management.

Parameters

setCreator

Creator for the Set used to track instances.

Inheritors

Constructors

Link copied to clipboard
constructor(setCreator: () -> MutableSet<T>? = null)

Properties

Link copied to clipboard
protected val instances: MutableSet<T>

Functions

Link copied to clipboard
fun add(instance: T): Boolean
Link copied to clipboard
fun list(): Set<T>
Link copied to clipboard
fun remove(instance: T): Boolean