I need a little help with converting an Obj-C code to Java code.
Obj-C code :
NSArray * tmp = [_user.userDbAdapter executeQuery:query];
if ([[[tmp objectAtIndex:0] objectForKey:@"mediaType"] intValue] == M_COLLECTION_ANTHEM)
{
mtype = SECTYPE_AUDIO;
}
Java code :
ArrayList<Object> tmp = aUser.userDbAdapter.executeQuery(query);
if(tmp.get(0)){
//code
}
Is this the right way to do this…and how can I get objectForKey in Java ?
Thanks in advance!
Your query will return an array of NSDictionary objects in the Obj-C code… in java my best guess would be it returns a array of objects that implement the Map interface (behaves the same way as the NSDictionary class: http://download.oracle.com/javase/1.4.2/docs/api/java/util/Map.html).
You can then use tmp.get(0).get(“mediaType”) (if the objects in the array implement the Map interface that is).