     /// for testing, don't rely on this
     var size: UInt {
         get {
-            var acc: UInt = 0
-            apply({ item in
-                acc = acc + self.sizeOfItem(item.value)
-            })
+            let acc: UInt = reduce(0) { curr, item in
+                curr + self.sizeOfItem(item)
+            }
             return acc
         }
     }

        get {
            return "\(String(key)): \(String(value))"
        }
    }
}



import Foundation

class ListItem <Key: Hashable, Value> {
    let key: Key
    let value: Value
    var nextItem: ListItem<Key, Value>? = nil
    var prevItem: ListItem<Key, Value>? = nil
    init(withKey key: Key, value: Value) {
        self.value = value
        self.key = key
