Really helpful set of guava collections extensions...
# codereview
j
Really helpful set of guava collections extensions that I'm using a lot:
Copy code
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableSet

fun <T> Collection<T>.toImmutableList() : ImmutableList<T> = ImmutableList.copyOf(this)

fun <T> Collection<T>.toImmutableSet() : ImmutableSet<T> = ImmutableSet.copyOf(this)

operator fun <T> ImmutableList<T>.plus(elements : ImmutableList<T>) =
    ImmutableList.builder<T>().addAll(this).addAll(elements).build()!!