lib/core: add a factory to `Set` to instantiate a `HashSet` by default
authorAlexis Laferrière <alexis.laf@xymus.net>
Sun, 20 Dec 2015 14:21:58 +0000 (09:21 -0500)
committerAlexis Laferrière <alexis.laf@xymus.net>
Tue, 12 Jan 2016 18:13:03 +0000 (13:13 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

lib/core/collection/hash_collection.nit

index 926a1d9..c049332 100644 (file)
@@ -20,6 +20,11 @@ redef class Map[K, V]
        new do return new HashMap[K, V]
 end
 
+redef class Set[E]
+       # Get an instance of `HashMap[K, V]`, the default implementation
+       new do return new HashSet[E]
+end
+
 # A HashCollection is an array of HashNode[K] indexed by the K hash value
 private abstract class HashCollection[K]
        type N: HashNode[K]