Java Iterators. How to inspect the Iterator? -
i want know if there way inspect iterator object. kind of map? also, there a better way take contents of iterator object , put them in mapc? here code: import java.util.hashmap; import java.util.treemap; import java.util.map; import java.util.iterator; public class maps { public static void main(string[] args) { map mapa = new hashmap(); map mapb = new treemap(); mapa.put("key1", "element 1"); mapa.put("key2", "element 2"); mapa.put("key3", "element 3"); // 3 put() calls maps string value string key. can // obtain value using key. use get() method this: string element1 = (string) mapa.get("key1"); // why need type cast on right? system.out.println(element1); // lets iterate through keys of map: iterator iterator = mapa.keyset().iterator(); system.out.println(iterator); // how inspect this? kind of map? map mapc = new hashmap(); while(iter...