Iterator<Object> itr=list.iterator();
while(itr.hasNext()){
Object []obj=(Object[]) itr.next();------------------//line1
JSONObject jo = new JSONObject();
jo.put("routeNo", (int)obj[6]);
jo.put("routeName", obj[5].toString());
jo.put("stopSequenceID", (int)obj[4]);
jo.put("stopID", (int)obj[3]);
jo.put("stopName",obj[2].toString());
jo.put("lat", (double)obj[1]);
jo.put("lon", (double)obj[0]);
}
java.lang.ClassCastException: java.lang.Double cannot be cast to [Ljava.lang.Object;---------------------at line(1)
I am converting list to Object[].
As 'list' object contains 750 records. with the fields I am putting it on the 'jo' object. Each record contains those 7 fields.
Please help me . Thanks in advance
Object
is not anObject[]
. Perhaps if you explained what you needed to do with it, then we'd be able to help you out a bit better? Also, why you've got a collection ofObjects
in the first place is a bit bizarre...could you elaborate as to what that collection should contain? – Makoto Nov 18 '13 at 7:34Double
in your list, that's all. – RC. Nov 18 '13 at 7:35