renamed the rather long getOrElseUpdate to a simpler getOrPut which is a bit simpler and more accurate; as a new entry is put into the Map if its null

This commit is contained in:
James Strachan
2012-02-21 11:11:43 +00:00
parent 724f7860ab
commit a68b00dfd4
4 changed files with 8 additions and 7 deletions
+3 -2
View File
@@ -19,8 +19,9 @@ inline fun linkedList<T>(vararg values: T) : LinkedList<T> = values.to(LinkedLi
/** Returns a new HashSet with a variable number of initial elements */
inline fun hashSet<T>(vararg values: T) : HashSet<T> = values.to(HashSet<T>(values.size))
/** Returns a new hash map */
inline fun <K,V> hashMap() = HashMap<K,V>()
inline fun <K,V> hashMap(): HashMap<K,V> = HashMap<K,V>()
inline fun <K,V> sortedMap(): SortedMap<K,V> = TreeMap<K,V>()
val Collection<*>.indices : IntRange