Can someone please tell me what I'm doing wrong here.
I'm trying to access a Map and put the keys which start with the letter "N" in an array. However I'm getting a Cannot find symbol error referring to charAt(int)
? Intellij is suggesting me to create an abstract class for chartAt
?
import java.util.Map;
public class RoadNetwork {
String[] nodeList;
public void storeNodes(Map<String, Element> result) {
int counter =0;
nodeList = new String[result.size()];
//Cycle through Map to find elements which are Nodes
for (int i = 0; i < result.size(); i++) {
//if Node, then add it to array
if (result.get(i).charAt(0) == "N") {
nodeList[i] = String.valueOf(result.get(i));
counter++;
}
}
System.out.println("Nodes Array Length" + counter);
}
}