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

Method remove

output/java_guava/1.4.17/TreeMultiset.java:278–302  ·  view source on GitHub ↗
(@Nullable Object element, int occurrences)

Source from the content-addressed store, hash-verified

276 }
277
278 @CanIgnoreReturnValue
279 @Override
280 public int remove(@Nullable Object element, int occurrences) {
281 checkNonnegative(occurrences, "occurrences");
282 if (occurrences == 0) {
283 return count(element);
284 }
285 AvlNode<E> root = rootReference.get();
286 int[] result = new int[1]; // used as a mutable int reference to hold result
287 AvlNode<E> newRoot;
288 try {
289 @SuppressWarnings("unchecked")
290 E e = (E) element;
291 if (!range.contains(e) || root == null) {
292 return 0;
293 }
294 newRoot = root.remove(comparator(), e, occurrences, result);
295 } catch (ClassCastException e) {
296 return 0;
297 } catch (NullPointerException e) {
298 return 0;
299 }
300 rootReference.checkAndSet(root, newRoot);
301 return result[0];
302 }
303
304 @CanIgnoreReturnValue
305 @Override

Callers

nothing calls this directly

Calls 10

countMethod · 0.95
setCountMethod · 0.95
getMethod · 0.65
containsMethod · 0.65
removeMethod · 0.65
comparatorMethod · 0.65
getElementMethod · 0.65
checkNonnegativeMethod · 0.45
checkAndSetMethod · 0.45
checkRemoveMethod · 0.45

Tested by

no test coverage detected