MCPcopy Index your code
hub / github.com/antlr/codebuff / InPredicate

Class InPredicate

output/java_guava/1.4.17/Predicates.java:608–646  ·  view source on GitHub ↗

@see Predicates#in(Collection)

Source from the content-addressed store, hash-verified

606 /** @see Predicates#in(Collection) */
607
608 private static class InPredicate<T> implements Predicate<T>, Serializable {
609
610 private final Collection<?> target;
611 private InPredicate(Collection<?> target) {
612 this.target = checkNotNull(target);
613 }
614
615 @Override
616 public boolean apply(@Nullable T t) {
617 try {
618 return target.contains(t);
619 } catch (NullPointerException e) {
620 return false;
621 } catch (ClassCastException e) {
622 return false;
623 }
624 }
625
626 @Override
627 public boolean equals(@Nullable Object obj) {
628 if (obj instanceof InPredicate) {
629 InPredicate<?> that = (InPredicate<?>) obj;
630 return target.equals(that.target);
631 }
632 return false;
633 }
634
635 @Override
636 public int hashCode() {
637 return target.hashCode();
638 }
639
640 @Override
641 public String toString() {
642 return "Predicates.in(" + target + ")";
643 }
644
645 private static final long serialVersionUID = 0;
646 }
647
648 /** @see Predicates#compose(Predicate, Function) */
649

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected