Java tutorial
//package com.java2s; import java.util.Hashtable; import java.util.Vector; public class Main { public static Hashtable contarElementos(Vector list) { Hashtable hash = new Hashtable(); for (int i = 0; i < list.size(); i++) { Object key = list.elementAt(i); if (hash.containsKey(key)) { Integer qtde = new Integer(((Integer) hash.get(key)).intValue() + 1); hash.put(key, qtde); } else { hash.put(key, new Integer(1)); } } return hash; } }