1Set.newHashSet(3kaya) Kaya module reference Set.newHashSet(3kaya)
2
3
4
6 Set::newHashSet - Create a new empty HashSet.
7
9 HashSet<a> newHashSet( Int buckets=157, Int(a) hashfn=hash )
10
12 buckets The number of hashing buckets to use. A larger number of buck‐
13 ets increases the speed of the dictionary (up to a limit) but uses more
14 memory. A good choice is the nearest prime number to 1.5*(expected num‐
15 ber of entries) , with the default being 157.
16
17 hashfn The hashing function to use. This function must take a key, and
18 return an integer. A good hashing function will return different values
19 for similar keys (but must of course always return the same value for
20 the same key!). A default built-in hashing function is provided, though
21 if the keys are of type String , the Builtins.strHash (3kaya) function
22 should be used instead, and if the keys are of type Int you may use
23 Builtins.identity (3kaya) (though an array may provide faster insertion
24 and lookup if the keys are positive and either small or largely sequen‐
25 tial). If the keys are an especially complex data type, it may again be
26 best to write your own hashing function. This argument may be omitted
27 and defaults to Builtins.hash (3kaya)
28
29
31 Create a new empty HashSet.
32
34 Kaya standard library by Edwin Brady, Chris Morris and others
35 (kaya@kayalang.org). For further information see http://kayalang.org/
36
38 The Kaya standard library is free software; you can redistribute it
39 and/or modify it under the terms of the GNU Lesser General Public
40 License (version 2.1 or any later version) as published by the Free
41 Software Foundation.
42
44 Set.HashSet (3kaya)
45 Set.add (3kaya)
46 Set.array (3kaya)
47 Set.delete (3kaya)
48 Set.elem (3kaya)
49 Set.empty (3kaya)
50
51
52
53Kaya December 2010 Set.newHashSet(3kaya)