Example #1
0
        public static IMap <K, V> FindAll <K, V>(IMap <K, V> map, CheckDelegate <K, V> checkDelegate,
                                                 MapConstructorDelegate <K, V> mapConstructorDelegate)
        {
            IMap <K, V> result = mapConstructorDelegate();

            foreach (Entry <K, V> entry in map)
            {
                if (checkDelegate(entry))
                {
                    result.Put(entry.Key, entry.Value);
                }
            }

            return(result);
        }
Example #2
0
        public static IMap <K, V> FindAll <K, V>(IMap <K, V> sourcemap, CheckDelegate <K, V> checkdel, MapConstructorDelegate <K, V> constdel) where K : IComparable where V : IComparable
        {
            IMap <K, V> temp = constdel();

            foreach (IEntry <K, V> i in sourcemap)
            {
                if (checkdel(i))
                {
                    temp.Put(i.Key, i.Value);
                }
            }
            return(temp);
        }
Example #3
0
 static MapUtilsGeneric()
 {
     ArrayMapConstructor = new MapConstructorDelegate(() => { return(new ArrayMap <K, V>()); });
 }