Skip to content

Instantly share code, notes, and snippets.

Robert Ekendahl rekendahl

View GitHub Profile
@rekendahl
rekendahl / scratch.kt
Created Nov 3, 2017
Kotlin list merge example
View scratch.kt
if (defines[macroName]?.body?.isNotEmpty() == true) {
val mergedList = mutableListOf<Pair<IElementType?, String?>>()
for (tokenInfo in defines[macroName]?.body.orEmpty()) {
val tokenType = tokenInfo.first
val tokenName = tokenInfo.second
when (tokenType) {
CD_TICK_TICK -> {
val lastToken = mergedList.last()
mergedList.remove(lastToken)
val nextToken = defines[macroName]?.body?.iterator()?.next()
You can’t perform that action at this time.