I am iterating over hashmap, but these strange brackets [ ] are there while iterating, Can any body guide me how can i get rid of it.
Thanks
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry)it.next();
System.out.println(pairs.getKey() + " = " + pairs.getValue());
Log.v("Pairs get key", pairs.getKey().toString());
Log.v("Pairs get value", pairs.getValue().toString());
mysection.add(pairs.getKey().toString());
temp.add(pairs.getValue().toString());
it.remove(); // avoids a ConcurrentModificationException
}
Ok, i got the answer, the problem was map when displayed into console will show , and [] symbol. So to avoid it use another implementation to iterate over map and not this one.