Add EntityCollection
This commit is contained in:
13
src/main/kotlin/fr/postgresjson/entity/EntityCollection.kt
Normal file
13
src/main/kotlin/fr/postgresjson/entity/EntityCollection.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package fr.postgresjson.entity
|
||||
|
||||
class EntityCollection<T, E : EntityI<T>> {
|
||||
var collection: MutableMap<T, E> = mutableMapOf()
|
||||
|
||||
fun get(id: T): E? {
|
||||
return collection[id]
|
||||
}
|
||||
|
||||
fun set(entity: E) {
|
||||
collection.set(entity.id, entity)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user