]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl
(refs #7560) Deprecated Extras/HashMap
[simantics/platform.git] / bundles / org.simantics.scl.osgi / scl / Extras / HashMap.scl
index e055c81c32e37727013a1d8b750de5cf71f88d5a..312f57c5465dfee82fb8f1003331045bd4d5a29f 100644 (file)
@@ -1,23 +1,31 @@
-import "StandardLibrary" hiding (contains)
+module {
+    deprecated = "Use module MMap instead."
+}
 
-importJava "gnu.trove.map.hash.THashMap" where
-    data T a b
-    
-    @JavaName "<init>"
-    create :: () -> <Proc> T a b
-    put :: T a b -> a -> b -> <Proc> Maybe b
-    get :: T a b -> a -> <Proc> Maybe b
-    @JavaName get
-    unsafeGet :: T a b -> a -> <Proc> b
+import "MMap" as MMap
+
+type T a b = MMap.T a b
+
+create :: () -> <Proc> T a b
+create = MMap.create
+
+put :: T a b -> a -> b -> <Proc> Maybe b
+put = MMap.put
+
+get :: T a b -> a -> <Proc> Maybe b
+get = MMap.get
+
+unsafeGet :: T a b -> a -> <Proc> b
+unsafeGet = MMap.unsafeGet
     
-    contains :: T a b -> a -> <Proc> Boolean
-    size :: T a b -> <Proc> Integer
+contains :: T a b -> a -> <Proc> Boolean
+contains = MMap.containsKey
+
+size :: T a b -> <Proc> Integer
+size = MMap.size
     
-importJava "org.simantics.scl.osgi.map.HashMapUtils" where 
-    entries :: T a b -> <Proc> [(a,b)]
+entries :: T a b -> <Proc> [(a,b)]
+entries = MMap.entries
 
 fromList :: [(a,b)] -> <Proc> T a b
-fromList entries = do
-    result = create ()
-    for entries (\(k,v) -> do put result k v; ())
-    result 
\ No newline at end of file
+fromList = MMap.fromEntryList