I am trying to wrap a hashmap into another class, but I keep getting this
Unhandled exception java.lang.ClassCastException: java.util.TreeMap cannot be cast
It is pretty simple, not sure why Java is complaining. Here's the wrapper:
public class ResponseHeader extends HashMap<String, String> {
}
and here is the cast
protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
try {
// Save http headers
mResponseHeaders = (ResponseHeader)response.headers;
the response.headers is defined as such:
public final Map<String, String> headers;
I looked into this thread, but it is not what I seek.
Why does TreeSet throws ClassCastException
any explanations? thank you!
added, I forgot
private ResponseHeader mResponseHeaders = new ResponseHeader();