Skip to content

Instantly share code, notes, and snippets.

@simon-tse-hs
simon-tse-hs / CollectionAndSequence.kt
Last active June 28, 2017 17:30
CollectionAndSequence.kt
package com.simon.sample
import com.simon.sample.CollectionRange.to100
import com.simon.sample.CollectionRange.to1000
import com.simon.sample.CollectionRange.to10000
import com.simon.sample.CollectionRange.to100000
import com.simon.sample.CollectionRange.to1000000
import kotlin.system.measureTimeMillis
enum class CollectionType {
@simon-tse-hs
simon-tse-hs / Elvis.kt
Created June 13, 2017 21:25
Kotlin Elvis operator code that caused Proguard to fail
private fun doubleup(num: Int) : Int = num * 2
fun addOrDouble(a: Int, b: Int?): Int = b?.let { it + a } ?: doubleup(a)