Przykład

public class ClassA {
Collection c;
Map m;
public void methodA() {

m = (Map) c;
// ...
}

}
Rozwiązanie Upewnij się, że obiekt c jest typu Map.
Przykład

public class ClassA {
Collection c;
Map m;
public void methodA() {

if (c isntanceof Map){
m = (Map) c;
// ...

}

}