I have a general question about looping over a collection containing a complex object.
- I have a
Collection<Object>
, which contains anArray<E>
ofLinkedHashMap<K,V>
that I'm trying to extract values from. - I have tried various loops to get to the Key, Value pair but with no luck, something like;
The object looks like;
Collection<Object> dsidsToExclude = Arrays.asList(param.get("idsToExclude"));
for(Object id : dsidsToExclude) {
if(id instanceof ArrayList) {
// Loop over the list of <K,V>
for(Object kv : id) {
// I want to get extract the kv pairs here..
}
}
}
I want to know what the best way of doing this efficiently, any suggestions? Thanks.