Committed by
Sho Shimizu
Simplify method
Change-Id: I3d04245fb5462e0750c3bcfa687946742d44644f
Showing
2 changed files
with
2 additions
and
3 deletions
... | @@ -97,8 +97,7 @@ final class EncodableDiscreteResources implements DiscreteResources { | ... | @@ -97,8 +97,7 @@ final class EncodableDiscreteResources implements DiscreteResources { |
97 | 97 | ||
98 | @Override | 98 | @Override |
99 | public boolean containsAny(Set<DiscreteResource> other) { | 99 | public boolean containsAny(Set<DiscreteResource> other) { |
100 | - return other.stream() | 100 | + return !Sets.intersection(this.values(), other).isEmpty(); |
101 | - .anyMatch(x -> values().contains(x)); | ||
102 | } | 101 | } |
103 | 102 | ||
104 | @Override | 103 | @Override | ... | ... |
... | @@ -68,7 +68,7 @@ final class GenericDiscreteResources implements DiscreteResources { | ... | @@ -68,7 +68,7 @@ final class GenericDiscreteResources implements DiscreteResources { |
68 | 68 | ||
69 | @Override | 69 | @Override |
70 | public boolean containsAny(Set<DiscreteResource> other) { | 70 | public boolean containsAny(Set<DiscreteResource> other) { |
71 | - return other.stream().anyMatch(values::contains); | 71 | + return !Sets.intersection(this.values(), other).isEmpty(); |
72 | } | 72 | } |
73 | 73 | ||
74 | // returns a new instance, not mutate the current instance | 74 | // returns a new instance, not mutate the current instance | ... | ... |
-
Please register or login to post a comment