I am trying to loop through a HashSet of Enum Objects in Java 8 to see if a value is equal to a specific string. I have tried both equals
and ==
but its not returning true.
HashSet looks like:
I have tried the following:
for(Object g : groups){
if(g.equals("group_certification_staff")){
//Do stuff
}
for(Object g : groups){
if(g == "group_certification_staff"){
//Do stuff
}
but it keeps returning false
What am I missing?