MCPcopy Create free account
hub / github.com/antlr/codebuff / safeRemove

Method safeRemove

output/java_guava/1.4.17/Collections2.java:122–131  ·  view source on GitHub ↗

Delegates to Collection#remove. Returns false if the remove method throws a ClassCastException or NullPointerException.

(Collection<?> collection, @Nullable Object object)

Source from the content-addressed store, hash-verified

120 */
121
122 static boolean safeRemove(Collection<?> collection, @Nullable Object object) {
123 checkNotNull(collection);
124 try {
125 return collection.remove(object);
126 } catch (ClassCastException e) {
127 return false;
128 } catch (NullPointerException e) {
129 return false;
130 }
131 }
132
133 static class FilteredCollection<E> extends AbstractCollection<E> {
134 final Collection<E> unfiltered;

Callers 2

removeMethod · 0.95
removeMethod · 0.95

Calls 2

removeMethod · 0.65
checkNotNullMethod · 0.45

Tested by

no test coverage detected