Would something like the following work for you or perhaps you could use an entrySet iterator. Also, in your example, what is there to loop over if the size is not greater than 0?
// retrieve map from ExpiryData namespace
java.util.Map m = tr.getAllMapValues( "ExpiryData" );
_logger.info( "Going to try to loop over the keys" );
// iterating the keys looks like this
for ( String key : m.keySet() ) {
_logger.info( " Key value is: {}", key );
}
_logger.info( "Going to try to loop over the values");
// iterating the values looks like this
for ( String val : m.values() ) {
_logger.info( " Value is: {}", val );
}
OR
for ( java.util.Map.Entry entry : m.entrySet() ) {
_logger.info( "key is: {} and value is: {}", entry.getKey(), entry.getValue() );
}
UPDATED:
I just noticed your logic. If you use the method tr.putMapValue("ExpiryData", "sessionID", sessionID); you will never have more than one entry in your persistent model map. The key is more likely the variable sessionID. If a sessionID exists and you fire the "putMapValue" a second time, the value of the existing sessionID will be updated. PMM will not create a duplicate entry in the map. Perhaps, your put looks more like this:
tr.putMapValue( "ExpiryData", sessionID, "some string value here" );
Take a look at the differences in the attached test case. Run in ITR mode and review the Events tab. The logger displays provide some insight as to what I am saying with regard to the key.