I followed advice on constructing a static hashmap from other SO posts, but now I am having a null pointed exception when I try to access the information in the HashMap. Any ideas?
public final class EMUtil {
static private HashMap<String,TreeSet<String>> EMGroups;
static{
HashMap<String,TreeSet<String>> EMGroups = new HashMap<String, TreeSet<String>>();
TreeSet<String> temp=new TreeSet<String>();
temp.addAll(returnArray("99201","99202","99203","99204","99205"));
EMGroups.put("Set 1",temp);
temp=new TreeSet<String>();
temp.addAll(returnArray("99211","99212","99213","99214","99215"));
EMGroups.put("Set 2",temp);
...
}
static public boolean isEM(String curCPT){
if((curCPT.compareTo("99200")>0)&&(curCPT.compareTo("99311")<0)){
for(TreeSet<String> value:EMGroups.values()){
if(value.contains(curCPT)){
return true;
}
}
}
return false;
}
Any ideas what is going on? If I am trying to have a group of sets that I access to check if a String is in a group within that set / which group it is in are there better ways to structure this?