Skip to content

Commit

Permalink
API, Core: Remove unnecessary casts to Iterable<T> (#11601)
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra authored Nov 20, 2024
1 parent 918f81f commit d19e3ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,9 @@ public <T> Expression predicate(UnboundPredicate<T> pred) {
pred.op(), pred.term(), (T) sanitize(pred.literal(), now, today));
case IN:
case NOT_IN:
Iterable<String> iter =
() -> pred.literals().stream().map(lit -> sanitize(lit, now, today)).iterator();
return new UnboundPredicate<>(pred.op(), pred.term(), (Iterable<T>) iter);
Iterable<T> iter =
() -> pred.literals().stream().map(lit -> (T) sanitize(lit, now, today)).iterator();
return new UnboundPredicate<>(pred.op(), pred.term(), iter);
default:
throw new UnsupportedOperationException(
"Cannot sanitize unsupported predicate type: " + pred.op());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ private static <T> UnboundPredicate<T> predicateFromJson(
node.has(VALUE), "Cannot parse %s predicate: missing value", op);
Preconditions.checkArgument(
!node.has(VALUES), "Cannot parse %s predicate: has invalid values field", op);
Object value = literal(JsonUtil.get(VALUE, node), convertValue);
return Expressions.predicate(op, term, (Iterable<T>) ImmutableList.of(value));
T value = literal(JsonUtil.get(VALUE, node), convertValue);
return Expressions.predicate(op, term, ImmutableList.of(value));
case IN:
case NOT_IN:
// literal set predicates
Expand Down

0 comments on commit d19e3ff

Please sign in to comment.