Skip to content

Instantly share code, notes, and snippets.

View abrownventuretech's full-sized avatar

Andrew Brown abrownventuretech

View GitHub Profile
@bastman
bastman / collections.kt
Last active February 1, 2023 03:15
kotlin: How to join 2 collections by a foreign key predicate
data class Off(val id: Int, val offName: String)
data class Prop(val id: Int, val propName: String, val offId: Int)
data class Joined(val off: Off, val props: List<Prop>)
fun main(args: Array<String>) {
val offs: List<Off> = listOf(
Off(id = 1, offName = "Off A"),
Off(id = 2, offName = "Off B")
)
val props: List<Prop> = listOf(