guava/src/com/google/common/collect/Collections2.java
static boolean safeRemove(Collection<?> collection, @Nullable Object object) {
    checkNotNull(collection);
    try {
      return collection.remove(object);
    } catch (ClassCastException | NullPointerException e) {
      return false;
    }
  }
static boolean safeRemove(Collection<?> collection, @Nullable Object object) {
    checkNotNull(collection);
    try {
      return collection.remove(object);
    } catch (ClassCastException | NullPointerException e) {
      return false;
    }
  }
Delegates to {@link Collection#remove}. Returns {@code false} if the {@code remove} method
throws a {@code ClassCastException} or {@code NullPointerException}.