public static < T , K , V > Map < K , V > toMap ( Stream < T > stream , Function < T , K > keySupplier , Function < T , V > valueSupplier ) { return stream . collect ( Collectors . toMap ( keySupplier , valueSupplier ) ) ; }
Collect stream to map .