android/guava/src/com/google/common/collect/ForwardingSortedSet.java
@Override
  @Beta
  protected boolean standardContains(@NullableDecl Object object) {
    try {
      // any ClassCastExceptions are caught
      @SuppressWarnings("unchecked")
      SortedSet<Object> self = (SortedSet<Object>) this;
      Object ceiling = self.tailSet(object).first();
      return unsafeCompare(ceiling, object) == 0;
    } catch (ClassCastException | NoSuchElementException | NullPointerException e) {
      return false;
    }
  }
@Override
  @Beta
  protected boolean standardContains(@NullableDecl Object object) {
    try {
      // any ClassCastExceptions are caught
      @SuppressWarnings("unchecked")
      SortedSet<Object> self = (SortedSet<Object>) this;
      Object ceiling = self.tailSet(object).first();
      return unsafeCompare(ceiling, object) == 0;
    } catch (ClassCastException | NoSuchElementException | NullPointerException e) {
      return false;
    }
  }
A sensible definition of {@link #contains} in terms of the {@code first()} method of {@link
#tailSet}. If you override {@link #tailSet}, you may wish to override {@link #contains} to
forward to this implementation.

@since 7.0