public static < K , V > void fillValues ( Map < K , V > map , Iterable < ? extends V > values ) { Iterator < ? extends V > iterator = values . iterator ( ) ; for ( K k : map . keySet ( ) ) { if ( ! iterator . hasNext ( ) ) { break ; } V value = iterator . next ( ) ; map . put ( k , value ) ; } }
Fill the given map sequentially with the values from the given sequence . This method will iterate over all keys of the given map and put the corresponding value element into the map . If the map is larger than the sequence then the remaining entries will remain unaffected .