corda / net.corda.node.utilities / AbstractJDBCHashSet

# AbstractJDBCHashSet

`abstract class AbstractJDBCHashSet<K : Any, out T : JDBCHashedTable> : MutableSet<K>, AbstractSet<K>`

Base class for JDBC backed hash set that delegates to a JDBC backed hash map where the values are all Unit and not actually persisted. Iteration order is order of insertion. Iterators can remove().

See AbstractJDBCHashMap for implementation details.

### Constructors

<init> | `AbstractJDBCHashSet(table: T, loadOnInit: Boolean = false, maxBuckets: Int = DEFAULT_MAX_BUCKETS)` Base class for JDBC backed hash set that delegates to a JDBC backed hash map where the values are all Unit and not actually persisted. Iteration order is order of insertion. Iterators can remove().

### Properties

innerMap | `val innerMap: AbstractJDBCHashMap<K, Unit, T>`
size | `open val size: Int`
table | `val table: T`

### Functions

add | `open fun add(element: K): Boolean`
addElementToInsert | `abstract fun addElementToInsert(insert: InsertStatement, entry: K, finalizables: MutableList<() -> Unit>): Unit` Implementation should marshall the element to the insert statement.
clear | `open fun clear(): Unit`
contains | `open fun contains(element: K): Boolean`
elementFromRow | `abstract fun elementFromRow(row: ResultRow): K` Implementation should return the element object marshalled from the database table row.
isEmpty | `open fun isEmpty(): Boolean`
iterator | `open fun iterator(): MutableIterator<K>`
remove | `open fun remove(element: K): Boolean`

### Extension Functions

noneOrSingle | `fun <T> Iterable<T>.noneOrSingle(predicate: (T) -> Boolean): T?` Returns the single element matching the given predicate, or `null` if element was not found, or throws if more than one element was found. `fun <T> Iterable<T>.noneOrSingle(): T?` Returns single element, or `null` if element was not found, or throws if more than one element was found.

### Inheritors

JDBCHashSet | `class JDBCHashSet<K : Any> : AbstractJDBCHashSet<K, BlobSetTable>` A convenient JDBC table backed hash set with iteration order based on insertion order. See AbstractJDBCHashSet and AbstractJDBCHashMap for further implementation details.