Iterate ArrayList

Ranch Hand

Posts: 146

HI, I am trying to iterate the hash Map. But, I am getting error at "for loop" please help.

I want the each value in the arraylist and do some string manipulation.

import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class IterateMap { /** * @param args */ public static void main[String[] args] { Map myMap = new HashMap[]; List uList = new ArrayList[]; uList.add["week1"]; uList.add["week2"]; myMap.put["April", [ArrayList] uList]; uList.add["week3"]; uList.add["week4"]; myMap.put["May", [ArrayList] uList]; int i=0; int j=0; for [String key : myMap.keySet[]] { //

Chủ Đề