add java.util.Map's size and empty properties
This commit is contained in:
@@ -1,20 +1,16 @@
|
||||
package std.util
|
||||
|
||||
import java.util.*
|
||||
import java.util.Map as JMap
|
||||
|
||||
// Map APIs
|
||||
|
||||
/** Returns the size of the map */
|
||||
/* TODO get redeclaration errors
|
||||
val Map<*,*>.size : Int
|
||||
val JMap<*,*>.size : Int
|
||||
get() = size()
|
||||
*/
|
||||
|
||||
/** Returns true if this map is empty */
|
||||
/* TODO get redeclaration errors
|
||||
val Map<*,*>.empty : Boolean
|
||||
val JMap<*,*>.empty : Boolean
|
||||
get() = isEmpty()
|
||||
*/
|
||||
|
||||
/** Returns the value for the given key or returns the result of the defaultValue function if there was no entry for the given key */
|
||||
inline fun <K,V> java.util.Map<K,V>.getOrElse(key: K, defaultValue: ()-> V) : V {
|
||||
|
||||
Reference in New Issue
Block a user