# | Line 239 | Line 239 | public class ConcurrentLinkedQueue<E> ex | |
---|---|---|
239 | public int size() { | |
240 | int count = 0; | |
241 | for (AtomicLinkedNode p = first(); p != null; p = p.getNext()) { | |
242 | < | if (p.getItem() != null) |
243 | < | ++count; |
242 | > | if (p.getItem() != null) { |
243 | > | // Collections.size() spec says to max out |
244 | > | if (++count == Integer.MAX_VALUE) |
245 | > | break; |
246 | > | } |
247 | } | |
248 | return count; | |
249 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |