I have the following map:
Map<City, Integer> map = getMap();
and my class City:
public class City {
private String c1;
private String c2;
public City(String c1, String c2){
this.c1 = c1;
this.c2 = c2;
}
Now I have a map full of values, and I need to look for a specific key, for example :"London, Paris". My main approach is this one:
map.get(new City("London", "Paris"));
For some reason, it is giving me
Exception in thread "main" java.lang.NullPointerException
and I'm almost sure I cannot do this way.