private List < Data > getKeyValueSequence ( Map < ? , ? > entries ) { if ( entries == null || entries . isEmpty ( ) ) { return Collections . emptyList ( ) ; } List < Data > keyValueSequence = new ArrayList <> ( entries . size ( ) * 2 ) ; for ( Map . Entry < ? , ? > entry : entries . entrySet ( ) ) { Object key = entry . getKey ( ) ; Object value = entry . getValue ( ) ; Data dataKey = mapServiceContext . toData ( key ) ; Data dataValue = mapServiceContext . toData ( value ) ; keyValueSequence . add ( dataKey ) ; keyValueSequence . add ( dataValue ) ; } return keyValueSequence ; }
Transforms a map to a list of serialised alternating key - value pairs .