Not able to iterate items from itemSet
<p>hey guys am not able iterate or get items from ItemSet following is my code</p>

<p>Item class </p>

<pre><code>public class Item {

    private String id; 
    private int count;
    private String  name;

    public int getcount() {
       return this.count; 
    }

    public Item(String name) {
        this.name=name;
        this.id = "";
    }

    public Item(String id, String name) {
        this.name=name;
        this.id=id;
    }

    public Item(int count) {
        this.count=count;
    }

    public String getItemName() {
        return this.name;
    }

    public String getItemId() {
        return this.id;
    }

    public Item returnItems(ItemSet itemset) {
        Item item=null;
        return item;
    }

}
</code></pre>

<p>ItemSet Class holds List of items</p>

<pre><code>public  class ItemSet   {

    private List&lt;Item&gt; hold;

    ItemSet(Item item) {
        hold = new ArrayList&lt;Item&gt;();
        this.hold.add(item); 
    }

    ItemSet() {
        //throw new UnsupportedOperationException("Not yet implemented");
    }   

    public List&lt;Item&gt; getItemSet() {
        return this.hold;
    }    

    public void addItems(Item item) {
        hold = new ArrayList&lt;Item&gt;();
        this.hold.add(item);
    }

}
</code></pre>

<p>This is my Transaction class holds list of ItemSets</p>

<pre><code>public class Transaction  {

    private List&lt;ItemSet&gt; trans;

    public ItemSet getUniqueItem() {
        ResultSet rs;
        Database d=new Database();
        ItemSet unique=new ItemSet();
        String query="Select id,name from item";
        rs=d.sendQuery(query);
        try{  
            while(rs.next()) {
                System.out.println(rs.getString(1)+"\t"+rs.getString(2));
                Item item=new Item(rs.getString(1),rs.getString(2));
                unique.addItems(item);      
            } 
        } catch(Exception e) { 
            System.out.print(e.getMessage());
        }
        return unique;
    }

}
</code></pre>

<p>And this is my main class</p>

<pre><code>public class Ap {

    public static void main(String args[]) {
        Transaction t=new Transaction();
        Transaction Ci=new Transaction();
        Transaction Li=new Transaction();

        ItemSet I=t.getUniqueItem();    //11
    }
}
</code></pre>

<p>I dont know how to get Items from ItemSet at 11</p>

<p>I tried using </p>

<pre><code>foreach(Item i:I) {

}
</code></pre>

<p>But I am getting error.</p>
