ClassCastException : cant be cast to java.lang.Integer

前端 未结 4 635
谎友^
谎友^ 2021-01-07 14:20

I know this has been asked a lot in stackoverflow but I could not find answers that work to my problem.

In the following code below, I cant print out each item in

4条回答
  •  心在旅途
    2021-01-07 14:49

    private HashMapArrayList>  edges;
    
    // ...later
    
    Edge e = new Edge(from,to,T);
    
    // ...later
    
    else {
        tmp = new ArrayList();
        edges.put(e.from,tmp);
    }
    tmp.add(e);
    

    Ultimately, this is a classic example of why raw types are bad. You've got an ArrayList and you put Edges in it.

    Unfortunately, I don't know how to tell you how to fix it since I don't understand what you're trying to do.

提交回复
热议问题