(@Nullable E element, int occurrences)
| 254 | } |
| 255 | |
| 256 | @CanIgnoreReturnValue |
| 257 | @Override |
| 258 | public int add(@Nullable E element, int occurrences) { |
| 259 | checkNonnegative(occurrences, "occurrences"); |
| 260 | if (occurrences == 0) { |
| 261 | return count(element); |
| 262 | } |
| 263 | checkArgument(range.contains(element)); |
| 264 | AvlNode<E> root = rootReference.get(); |
| 265 | if (root == null) { |
| 266 | comparator().compare(element, element); |
| 267 | AvlNode<E> newRoot = new AvlNode<E>(element, occurrences); |
| 268 | successor(header, newRoot, header); |
| 269 | rootReference.checkAndSet(root, newRoot); |
| 270 | return 0; |
| 271 | } |
| 272 | int[] result = new int[1]; // used as a mutable int reference to hold result |
| 273 | AvlNode<E> newRoot = root.add(comparator(), element, occurrences, result); |
| 274 | rootReference.checkAndSet(root, newRoot); |
| 275 | return result[0]; |
| 276 | } |
| 277 | |
| 278 | @CanIgnoreReturnValue |
| 279 | @Override |
no test coverage detected