ArrayList userItem = new ArrayList();
userItem.add(item.getUserId()+"|"+item.getEmail()+"|"+item.getImgInstance());
ArrayList userItem = onlineUsers.get(item.getImgInstance());
I want to know what the last line will do to the list will it append the value of onlineUsers.get(item.getImgInstance()) in the previous string or somethign else? how does it keep track of the item's beign added?
P.s if you can please also explain the structure of ArrayList.
Thank you edited:
Sorry guys you have misunderstood what i was trying to ask cause i didnt put the complete code its actually this
HashMap> onlineUsers = new HashMap(100);
for(DBPresence item : listPresence){
if(onlineUsers.containsKey(item.getImgInstance())){
ArrayList userItem = onlineUsers.get(item.getImgInstance());
userItem.add(item.getUserId()+"|"+item.getEmail()+"|"+item.getImgInstance());
}else{
ArrayList userItem = new ArrayList();
userItem.add(item.getUserId()+"|"+item.getEmail()+"|"+item.getImgInstance());
onlineUsers.put(new Integer(item.getImgInstance()),userItem);
}
}
return new DBPresenceResponse(onlineUsers, _encapusulationText);