Decouple add from nextFreeIndex in IdMap
This commit is contained in:
parent
5769cff60b
commit
e2d27e34a5
@ -19,7 +19,7 @@ class IdMap<T : Any>(val min: Int = 0, val max: Int = Int.MAX_VALUE, private val
|
|||||||
return nextIndex
|
return nextIndex
|
||||||
}
|
}
|
||||||
|
|
||||||
fun add(value: T): Int {
|
fun nextFreeIndex(): Int {
|
||||||
var i = 0
|
var i = 0
|
||||||
var index = next()
|
var index = next()
|
||||||
|
|
||||||
@ -41,6 +41,11 @@ class IdMap<T : Any>(val min: Int = 0, val max: Int = Int.MAX_VALUE, private val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return index
|
||||||
|
}
|
||||||
|
|
||||||
|
fun add(value: T): Int {
|
||||||
|
val index = nextFreeIndex()
|
||||||
map[index] = value
|
map[index] = value
|
||||||
return index
|
return index
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user