Skip to main content
1 of 2

Problems with ArrayList<HashMap<String,String>> and IF-STATEMENT

I have a Array List with HashMap

deviceDataCollection = new ArrayList<HashMap<String,String>>();

I have to retrieve some data from this Array e compare using an IF-STATMENT, like the code below:

String DeviceType = deviceDataCollection.get(position).get("var").toString(); //it returns a string: lamp if (DeviceType == "lamp") { // do something } 

The problem is: I can't get enter the IF-STATEMENT. I'm sure the values are exact the same.

I don't know what to do.

Thanks.