static < K , V > Map < K , V > keyValuesToMap ( Iterator < KeyValue < K , V > > keyValues ) { Map < K , V > map = new HashMap <> ( ) ; keyValues . forEachRemaining ( pair -> map . put ( pair . getKey ( ) , pair . getValue ( ) ) ) ; return map ; }
Transforms an iterator of key - value pairs into a map