private < V > BiMap < V , Integer > createIndex ( Set < V > values ) { if ( values == null ) { return null ; } ImmutableBiMap . Builder < V , Integer > builder = ImmutableBiMap . builder ( ) ; int idx = 0 ; for ( V value : values ) { builder . put ( value , idx ++ ) ; } return builder . build ( ) ; }
Creates a map of indexes based on the iteration order of the given set .