Hello I want to fill an hashmap with value => key :idissue value:arraylist (list of assignee) The problem that my function return the same liste of assignee for all my issues: My map{10700=[x,y,z], 10500=[x,y,z],10600=[x,y,z].......
Or the result should be like this: My map{10700=[x,y,z], 10500=[w,v,q,v,t,z],10600=[m,r,t,i]....... I treid to clear my list listassignee.clear(); after the put instruction but in this case is empty : My map{10700=[], 10500=[], 10601=[], 10400=[], 10401=[], 10301=[], 10300=[], 10600=[]}
Any suggestion please??
public HashMap<String ,ArrayList<String>> MAPAssigneeByissue() throws SQLException
{
Issue iss =new Issue(); //a class return list of issue
ArrayList<String> listassignee = new ArrayList<String>();
HashMap<String ,ArrayList<String>> mapTicketassignee = new HashMap<String ,ArrayList<String>> ();
Connectionx conn=new Connectionx();
for (Iterator it = iss.getListissue().iterator();it.hasNext();)
{
Object o = (Object) it.next();
String sql2;
sql2=" my SQL:retrieve list assignee for each ticket (o.tostring) ";
ResultSet rs2 = conn.st. executeQuery(sql2);
while(rs2.next())
{
String str= rs2.getString(1);
listassignee.add(str);
}
mapTicketassignee.put(o.toString(),listassignee);
//listassignee.clear();
}
System.out.println("My map"+mapTicketassignee.toString());
return mapTicketassignee;
}