diff --git a/src/main/java/com/google/devtools/build/lib/rules/android/databinding/DataBindingV2Context.java b/src/main/java/com/google/devtools/build/lib/rules/android/databinding/DataBindingV2Context.java index 38a2c5d1ad..b64b3b5a54 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/android/databinding/DataBindingV2Context.java +++ b/src/main/java/com/google/devtools/build/lib/rules/android/databinding/DataBindingV2Context.java @@ -16,2 +15,0 @@ package com.google.devtools.build.lib.rules.android.databinding; -import static com.google.common.base.Preconditions.checkArgument; - @@ -40,2 +38,2 @@ import com.google.devtools.build.lib.starlarkbuildapi.android.DataBindingV2Provi -import java.util.Collection; -import java.util.List; + +import java.util.*; @@ -43 +40,0 @@ import java.util.Map.Entry; -import java.util.Set; @@ -45,0 +43,3 @@ import java.util.function.Consumer; +import java.util.stream.Collectors; + +import static com.google.common.base.Preconditions.checkArgument; @@ -205 +205 @@ class DataBindingV2Context implements DataBindingContext { - ImmutableList.Builder brFiles = ImmutableList.builder(); + List brFiles = new ArrayList(); @@ -215 +215,4 @@ class DataBindingV2Context implements DataBindingContext { - return brFiles.build(); + return brFiles.stream() + .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Artifact::getExecPath)))) + .stream() + .collect(ImmutableList.toImmutableList()); @@ -219 +222 @@ class DataBindingV2Context implements DataBindingContext { - ImmutableList.Builder setterStoreFiles = ImmutableList.builder(); + List setterStoreFiles = new ArrayList<>(); @@ -229 +232,4 @@ class DataBindingV2Context implements DataBindingContext { - return setterStoreFiles.build(); + return setterStoreFiles.stream() + .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Artifact::getExecPath)))) + .stream() + .collect(ImmutableList.toImmutableList()); @@ -324 +330 @@ class DataBindingV2Context implements DataBindingContext { - ImmutableList.Builder classInfoFiles = ImmutableList.builder(); + List classInfoFiles = new ArrayList<>(); @@ -334 +340,4 @@ class DataBindingV2Context implements DataBindingContext { - return classInfoFiles.build(); + return classInfoFiles.stream() + .collect(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Artifact::getExecPath)))) + .stream() + .collect(ImmutableList.toImmutableList());