Java Map iterate value set

Description

Java Map iterate value set

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class Main {

  public static void main(String[] args) {
    Map<String, String> hMap = new HashMap<String, String>();
    hMap.put("1", "CSS");
    hMap.put("2", "HTML");
    hMap.put("3", "Java");

    Collection<String> c = hMap.values();
    Iterator<String> itr = c.iterator();
    while (itr.hasNext()) {
      System.out.println(itr.next());
    }//w ww  .j  a v  a  2 s  .  c  o m
  }
}



PreviousNext

Related