diff --git a/libraries/stdlib/src/kotlin/JUtil.kt b/libraries/stdlib/src/kotlin/JUtil.kt index 0b5c3176933..4aaa658fdfa 100644 --- a/libraries/stdlib/src/kotlin/JUtil.kt +++ b/libraries/stdlib/src/kotlin/JUtil.kt @@ -24,8 +24,7 @@ val Collection<*>.notEmpty : Boolean get() = isNotEmpty() /** Returns the Collection if its not null otherwise it returns the empty list */ -public fun Collection?.orEmpty() : Collection - = if (this != null) this else Collections.emptyList() as Collection +public fun Collection?.orEmpty() : Collection = this ?: Collections.emptyList() /** TODO these functions don't work when they generate the Array versions when they are in JLIterables */ @@ -37,8 +36,7 @@ public fun > Iterable.toSortedList(comparator: java.util.Com // List APIs /** Returns the List if its not null otherwise returns the empty list */ -public fun List?.orEmpty() : List - = if (this != null) this else Collections.emptyList() as List +public fun List?.orEmpty() : List = this ?: Collections.emptyList() /** TODO figure out necessary variance/generics ninja stuff... :)