From 724f7860abc42e9d2c71cb51bcc653fcd5203008 Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 21 Feb 2012 10:41:02 +0000 Subject: [PATCH] tried moving helper function to where the other global util functions are defined to try avoid namespace method disappearing --- stdlib/ktSrc/JavaUtil.kt | 4 ++++ stdlib/ktSrc/JavaUtilMap.kt | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stdlib/ktSrc/JavaUtil.kt b/stdlib/ktSrc/JavaUtil.kt index 36fc28165ec..502e87b9910 100644 --- a/stdlib/ktSrc/JavaUtil.kt +++ b/stdlib/ktSrc/JavaUtil.kt @@ -19,6 +19,10 @@ inline fun linkedList(vararg values: T) : LinkedList = values.to(LinkedLi /** Returns a new HashSet with a variable number of initial elements */ inline fun hashSet(vararg values: T) : HashSet = values.to(HashSet(values.size)) +/** Returns a new hash map */ +inline fun hashMap() = HashMap() + + val Collection<*>.indices : IntRange get() = 0..size-1 diff --git a/stdlib/ktSrc/JavaUtilMap.kt b/stdlib/ktSrc/JavaUtilMap.kt index 58f7917778c..d51e02193b8 100644 --- a/stdlib/ktSrc/JavaUtilMap.kt +++ b/stdlib/ktSrc/JavaUtilMap.kt @@ -51,6 +51,3 @@ inline fun java.util.Map.getOrElseUpdate(key: K, defaultValue: ()-> V return answer } } - -/** Returns a new hash map */ -inline fun hashMap() = HashMap() \ No newline at end of file