Skip to content

Commit 2833750

Browse files
陈易生khorshuheng
authored andcommitted
Make better use of java8 stream
Signed-off-by: Khor Shu Heng <khor.heng@gojek.com>
1 parent 7899bd5 commit 2833750

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

core/src/main/java/feast/core/model/FeatureTable.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ public void delete() {
359359

360360
public String protoHash() {
361361
List<String> sortedEntities =
362-
this.getEntities().stream().map(entity -> entity.getName()).collect(Collectors.toList());
363-
Collections.sort(sortedEntities);
362+
this.getEntities().stream().map(EntityV2::getName).sorted().collect(Collectors.toList());
364363

365-
List<FeatureV2> sortedFeatures = new ArrayList(this.getFeatures());
366364
List<FeatureSpecV2> sortedFeatureSpecs =
367-
sortedFeatures.stream().map(featureV2 -> featureV2.toProto()).collect(Collectors.toList());
368-
sortedFeatures.sort(Comparator.comparing(FeatureV2::getName));
365+
this.getFeatures().stream()
366+
.sorted(Comparator.comparing(FeatureV2::getName))
367+
.map(FeatureV2::toProto)
368+
.collect(Collectors.toList());
369369

370370
DataSourceProto.DataSource streamSource = DataSourceProto.DataSource.getDefaultInstance();
371371
if (getStreamSource() != null) {

0 commit comments

Comments
 (0)