I tried your code mocking the db:
public static void main(String[] args) {
HashMap db = new HashMap();
db.put(0, "zero");
db.put(1, "one");
db.put(2, "two");
db.put(3, "three");
Hashtable hashsample = new Hashtable();
for (int i = 0; i < db.size(); i++) {
hashsample.put(i, db.get(i));
System.out.println(hashsample);
}
}
and it works just fine. Here the output:
{0=zero}
{1=one, 0=zero}
{2=two, 1=one, 0=zero}
{3=three, 2=two, 1=one, 0=zero}
The problem I think is that your db.getData() return always the same thing.