Skip to main content
Post Closed as "exact duplicate" by Rahul, Matt Ball, Simon, laalto, Vatine
added 1 characters in body
Source Link
Matt Ball
  • 360.9k
  • 102
  • 655
  • 725

I have a Array List with HashMap

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

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.

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.

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.

Source Link

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.