Ciao; allora puoi recuperarti un Set di "keys" del Map e poi prendere l'iterator su di esso; ad esempio:
Non l'ho provato ma ad occhio dovrebbe andare.codice:Map theMap = new HashMap(); theMap.put( "uno","1" ); theMap.put( "due","2" ); theMap.put( "tre","3" ); theMap.put( "quattro","4" ); String key = null; String obj = null; for( Iterator i = theMap.keySet().iterator(); i.hasNaext(); ){ key = (String)(i.next()); System.out.println( "Chiave: "+ key ); obj = (String)theMap.get( key ); System.out.println( "Elemento: "+ obj ); }
Ciao![]()

Rispondi quotando