small-collection-utilities

Installation
SKILL.md

Four helpers, four ways they mislead

Small enough to write from memory, which is exactly why nobody re-reads them once they are in.

Symmetric difference

infix fun <E> Collection<E>.symmetricDifference(other: Collection<E>): Set<E> {
    val left = this subtract other
    val right = other subtract this
    return left union right
}

Answers "which elements are on exactly one side" — additions and removals in one pass, when reconciling a stored list of ids against a freshly fetched one.

Position index

Installs
2
GitHub Stars
35
First Seen
6 days ago
small-collection-utilities — maxrave-dev/kotlin-footguns