added working test casres for groovy style markup builders

This commit is contained in:
James Strachan
2012-01-04 12:59:37 +00:00
parent 8cfc979c10
commit 8c40aa58af
4 changed files with 175 additions and 52 deletions
+9
View File
@@ -1,6 +1,7 @@
package std.util
import java.util.Map as JMap
import java.util.Map.Entry as JEntry
// Map APIs
@@ -12,6 +13,14 @@ val JMap<*,*>.size : Int
val JMap<*,*>.empty : Boolean
get() = isEmpty()
/** Returns the key of the entry */
val <K,V> JEntry<K,V>.key : K
get() = getKey()
/** Returns the value of the entry */
val <K,V> JEntry<K,V>.value : V
get() = getValue()
/** 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 {
val current = this.get(key)