I have a class, GraphSearch, defined as such:
public class GraphSearch{
///code
}
In this class is the generics-parameterized method:
public static <T> int dsp(T start, Map<T, List<Pair<T, Integer>>> adjList, T goal) {
///code}
I have a main I do this setup and call the method as such:
GraphSearch g = new GraphSearch();
HashMap<String,ArrayList<Pair<String,Integer>>> k = new HashMap<String, ArrayList<Pair<String, Integer>>>();
////various setup to fill my map with valid stuff
///Pair is a class I made in my package
Then in main is
System.out.println("dsp from A to E is" + g.dsp("a", k, "e"));
I get an error.
The method dsp(T, Map<T,List<Pair<T,Integer>>>, T) in the type GraphSearch is not applicable for the arguments (String, HashMap<String,ArrayList<Pair<String,Integer>>>, String)
Well, why not? Is an ArrayList not a List? Is a String not a Generic-acceptable type? Is a Hashmap not a Map?
What's going on?