Skip to content

Instantly share code, notes, and snippets.

@nbness2
Last active May 20, 2023 10:49
Show Gist options
  • Save nbness2/6e35484a245abc5eaf631657a5b3d7a5 to your computer and use it in GitHub Desktop.
Save nbness2/6e35484a245abc5eaf631657a5b3d7a5 to your computer and use it in GitHub Desktop.
fun <I: Item> ItemContainer<I>.nbPartitionShift(predicate: (I) -> Boolean = Item::isInvalidItem) {
items
.partitionJoin(predicate)
.forEachIndexed { idx, item -> set(idx, item) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment