Skip to content

Commit

Permalink
TRY-198: fix collect
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-kripakov-m10 committed Dec 27, 2023
1 parent 116f38d commit 2fcaa8e
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -28,11 +27,10 @@ public static EmbeddingCollection from(final Stream<EnhancedEmbeddingProjection>
// we copy vector here just in case
var newMap = stream.map(e -> Map.entry(EmbeddingProjection.from(e), MatrixUtils.createRealVector(e.getEmbeddingData()))
).collect(
Collectors.toMap(
Collectors.toConcurrentMap(
Map.Entry::getKey,
Map.Entry::getValue,
(v1, v2) -> v1,
ConcurrentHashMap::new
(v1, v2) -> v1
)
);
return new EmbeddingCollection(newMap);
Expand Down

0 comments on commit 2fcaa8e

Please sign in to comment.