In JavaScript I can define the following collection with keys awaiting values
var items = {
'book':null,
'pen':null,
'pencil':null,
'chicken':null,
'wallet':null
};
Then when I am ready to add values to my collection, I can do for instance
for(var p in items){
if(some condition){
items[p]=someValue;
}
}
Is there a way to do this with the same level of efficiency in java?
I know that in old Java I can combine a Map and a List to accomplish this, but are their new data structures in Java that can handle this? I am talking about Java 7 (or 8) perhaps? I am using Google App-Engine for my Java.