Example #1
0
        public T Get(int key)
        {
            if (!dict.ContainsKey(key))
            {
                throw new IndexOutOfRangeException();
            }

            var nodeToGet = dict[key];

            return(list.Get(nodeToGet));
        }
Example #2
0
        public static void MyListGetTesting()
        {
            Console.WriteLine("======= Get operations testing =======");
            ListLRU <int> list   = new ListLRU <int>();
            var           head   = list.Add(100, 1);
            var           second = list.Add(200, 2);
            var           third  = list.Add(300, 3);
            var           tail   = list.Add(400, 4);

            Console.WriteLine(list.Get(head));
            Console.WriteLine(list);

            list.RemoveLastUsed();
            Console.WriteLine(list);
        }