Created
May 20, 2023 10:54
-
-
Save nbness2/adb52dd7705b5146c7401156caf72b5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <I: Item> ItemContainer<I>.codeusaShift(predicate: (I) -> Boolean = Item::isInvalidItem) { | |
val tempBank = items | |
var id = 0 | |
tempBank.forEachIndexed { index, item -> | |
if (!predicate(item)) { | |
items[id] = tempBank[id++] | |
} | |
} | |
for (index in id until items.size) { | |
items[index] = InvalidItem | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment