package kfs.kfsDbi;

import java.util.HashMap;
import java.util.Iterator;

/**
 *
 * @author pavedrim
 */
public class kfsPojoList<B extends kfsDbObject, ID, T extends kfsPojoObj<B>> implements kfsADb.loadCB, Iterable<T> {

    public static interface getId<B extends kfsDbObject, ID, T extends kfsPojoObj<B>>  {
        ID getUniqueId(T pj);
    }
    
    private final B base;
    private final getId<B,ID,T> getId;

    public kfsPojoList(B base, getId<B,ID,T> getId) {
        this.base = base;
        this.getId = getId;
    }
    private final HashMap<ID, T> lst = new HashMap<ID, T>();

    public void add(T rd) {
        lst.put(getId.getUniqueId(rd), rd);
    }

    @Override
    public boolean kfsDbAddItem(kfsRowData rd) {
        add((T) base.getPojo(rd));
        return true;
    }

    public T get(ID id) {
        return lst.get(id);
    }

    @Override
    public Iterator<T> iterator() {
        return lst.values().iterator();
    }

}

@@ -14,16 +14,45 @@
 fsDbi;%0A%0A
+import java.util.Collection;%0A
 import j
@@ -981,10 +981,85 @@
 %0A    %7D%0A%0A
+    public Collection%3CT%3E collection() %7B%0A        return lst.values();%0A    %7D%0A
 %7D%0A

remove obsolete import