]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.scl.osgi/scl/Extras/HashMap.scl
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.scl.osgi / scl / Extras / HashMap.scl
1 import "StandardLibrary" hiding (contains)
2
3 importJava "gnu.trove.map.hash.THashMap" where
4     data T a b
5     
6     @JavaName "<init>"
7     create :: () -> <Proc> T a b
8     put :: T a b -> a -> b -> <Proc> Maybe b
9     get :: T a b -> a -> <Proc> Maybe b
10     @JavaName get
11     unsafeGet :: T a b -> a -> <Proc> b
12     
13     contains :: T a b -> a -> <Proc> Boolean
14     size :: T a b -> <Proc> Integer
15     
16 importJava "org.simantics.scl.osgi.map.HashMapUtils" where 
17     entries :: T a b -> <Proc> [(a,b)]
18
19 fromList :: [(a,b)] -> <Proc> T a b
20 fromList entries = do
21     result = create ()
22     for entries (\(k,v) -> do put result k v; ())
23     result