Revert multiple mapping of stacks to each item
This commit is contained in:
parent
ca9b6cf5fb
commit
eb74baffb8
@ -120,7 +120,7 @@ interface IStorageProvider<T : IStorageStack> : IStorageEventProducer<T> {
|
|||||||
* @param key stack we want to find UUID of
|
* @param key stack we want to find UUID of
|
||||||
* @return UUID of stack if present
|
* @return UUID of stack if present
|
||||||
*/
|
*/
|
||||||
operator fun get(key: T): List<UUID> {
|
operator fun get(key: T): UUID? {
|
||||||
val key1 = key.let { if (it.count == BigInteger.ONE) it else it.key() }
|
val key1 = key.let { if (it.count == BigInteger.ONE) it else it.key() }
|
||||||
|
|
||||||
return stacks.filter {
|
return stacks.filter {
|
||||||
@ -129,7 +129,7 @@ interface IStorageProvider<T : IStorageStack> : IStorageEventProducer<T> {
|
|||||||
} else {
|
} else {
|
||||||
return@filter it.stack.key() == key1
|
return@filter it.stack.key() == key1
|
||||||
}
|
}
|
||||||
}.collect(Collectors.toList()).map { it.id }
|
}.findFirst().orElse(null)?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
val stacks: Stream<IStorageTuple<T>>
|
val stacks: Stream<IStorageTuple<T>>
|
||||||
|
@ -124,8 +124,8 @@ open class VirtualComponent<T : IStorageStack>(type: StorageStackType<T>) : IVir
|
|||||||
return ArrayList<IStorageTuple<T>>(hashedTuples.size).also { it.addAll(hashedTuples.values) }.stream()
|
return ArrayList<IStorageTuple<T>>(hashedTuples.size).also { it.addAll(hashedTuples.values) }.stream()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun get(key: T): List<UUID> {
|
override fun get(key: T): UUID? {
|
||||||
return hashedTuples[key.key()]?.id?.let(::listOf) ?: emptyList()
|
return hashedTuples[key.key()]?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("unchecked_cast")
|
@Suppress("unchecked_cast")
|
||||||
|
Loading…
Reference in New Issue
Block a user