         get {
             return "\(String(key)): \(String(value))"
         }
+    }
+}
+
+public struct ListItemGenerator <Key: Hashable, Value>: GeneratorType {
+    public typealias Element = Value
+    var currentItem: ListItem<Key, Value>?
+    
+    mutating public func next() -> Value? {
+        guard let i = currentItem else { return nil }
+        currentItem = i.nextItem
+        return i.value
     }
 }
 

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


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
