Skip to content

Commit 154db09

Browse files
authored
Merge pull request #3 from YikSanChan/better-use-java8-stream
Make better use of java8 stream
2 parents 01456c9 + a8145e8 commit 154db09

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)