Delegates to Collection#contains. Returns false if the contains method throws a ClassCastException or NullPointerException.
(Collection<?> collection, @Nullable Object object)
| 103 | */ |
| 104 | |
| 105 | static boolean safeContains(Collection<?> collection, @Nullable Object object) { |
| 106 | checkNotNull(collection); |
| 107 | try { |
| 108 | return collection.contains(object); |
| 109 | } catch (ClassCastException e) { |
| 110 | return false; |
| 111 | } catch (NullPointerException e) { |
| 112 | return false; |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * Delegates to {@link Collection#remove}. Returns {@code false} if the |