static Map < Integer , Integer > levelsToIndices ( Map < String , String > meta ) { Set < Map . Entry < String , String > > entries = meta . entrySet ( ) ; Map < Integer , Integer > levelToIdx = new HashMap <> ( ) ; for ( Map . Entry < String , String > entry : entries ) if ( entry . getKey ( ) . endsWith ( ARRAY_IDX_SUFFIX ) ) levelToIdx . put ( parseInt ( entry . getKey ( ) . substring ( 0 , entry . getKey ( ) . indexOf ( ' ' ) ) ) , parseInt ( entry . getValue ( ) ) ) ; return levelToIdx ; }
Converts all array index information in a given map of metadata to a map that is keyed only by the level and each value is the index in the array for that level . This is used to optimize lookup since a string is used for the key in the metadata that should not conflict with keys that other applications may want to set .