Hi
I have this annoying problem and I can't get my head around it.
basically I have an Arraylist with around 200 values in it.
But when I pass the value to a Hashmap only 80 are stored.
This is the syntax I am using for it :
Code:ArrayList<String> as = new ArrayList<String>(); while(st.hasMoreTokens()){ as.add(st.nextToken()); } System.out.println("The size of the ArrayList as is : " + as.size()); HashMap<String,Integer> map =new HashMap<String, Integer>(); for(int s=0;s<as.size();s++){ map.put(as.get(s),1); } System.out.println("The size of map : " + map.size()); // not all the values from the arraylist are stored
Can someone tell me what I am doing wrong? thank you




Reply With Quote