I am iterating through my hashMap object to fill up my array with either 0 or 1; I have a condition that when a record in my hashMap object equals "positive" then write "1" to my array else write "zero" to my array.
When I print the content of my array; all cells contain zeros, which is not the case.
Can you please advise why???
int index = 0;
if ( (!map.isEmpty()) && (index < PTFindings.length ) ) {
Iterator<Map.Entry<String, String>> iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry) iterator.next();
if(entry.getValue().equals("Positive")) {
PTFindings[index] = 1;
index++;
}
else if (entry.getValue().equals("Negative") ) {
PTFindings[index] = 0;
index++;
}
Log.d("map values", entry.getKey() + ": " +
entry.getValue().toString());
System.out.println("PTFindings at index " + index + " : " + PTFindings[index]);
}
}