Skip to content

Commit 1c2fc16

Browse files
authored
Lambda can be replaced with method reference (#3978)
Signed-off-by: Mengqi Xu <[email protected]>
1 parent 36e923f commit 1c2fc16

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

models/spring-ai-transformers/src/main/java/org/springframework/ai/transformers/TransformersEmbeddingModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ private Map<String, OnnxTensor> removeUnknownModelInputs(Map<String, OnnxTensor>
365365
return modelInputs.entrySet()
366366
.stream()
367367
.filter(a -> this.onnxModelInputs.contains(a.getKey()))
368-
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
368+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
369369

370370
}
371371

spring-ai-commons/src/main/java/org/springframework/ai/document/DefaultContentFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ else if (metadataMode == MetadataMode.EMBED) {
142142
return new HashMap<>(metadata.entrySet()
143143
.stream()
144144
.filter(e -> usableMetadataKeys.contains(e.getKey()))
145-
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
145+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
146146
}
147147

148148
public String getMetadataTemplate() {

spring-ai-model/src/main/java/org/springframework/ai/model/ModelOptionsUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ public static <T> T merge(Object source, Object target, Class<T> clazz, List<Str
186186
targetMap.putAll(sourceMap.entrySet()
187187
.stream()
188188
.filter(e -> e.getValue() != null)
189-
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())));
189+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)));
190190

191191
targetMap = targetMap.entrySet()
192192
.stream()
193193
.filter(e -> requestFieldNames.contains(e.getKey()))
194-
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
194+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
195195

196196
return ModelOptionsUtils.mapToClass(targetMap, clazz);
197197
}
@@ -229,7 +229,7 @@ public static Map<String, Object> objectToMap(Object source) {
229229
.entrySet()
230230
.stream()
231231
.filter(e -> e.getValue() != null)
232-
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
232+
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
233233
}
234234
catch (JsonProcessingException e) {
235235
throw new RuntimeException(e);

0 commit comments

Comments
 (0)