Skip to content

Commit

Permalink
Better parameter name
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed May 3, 2024
1 parent 8937b6a commit 1f1d6c5
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public int drainTo(final Collection<? super E> c) {
* Drains no more than the specified number of elements from the queue to the
* specified collection.
*
* @param c collection to add the elements to
* @param collection collection to add the elements to
* @param maxElements maximum number of elements to remove from the queue
*
* @return number of elements added to the collection
Expand All @@ -506,16 +506,16 @@ public int drainTo(final Collection<? super E> c) {
* @throws NullPointerException if c is null
* @throws IllegalArgumentException if c is this instance
*/
public int drainTo(final Collection<? super E> c, final int maxElements) {
Objects.requireNonNull(c, "c");
if (c == this) {
public int drainTo(final Collection<? super E> collection, final int maxElements) {
Objects.requireNonNull(collection, "collection");
if (collection == this) {
throw new IllegalArgumentException();
}
lock.lock();
try {
final int n = Math.min(maxElements, count);
for (int i = 0; i < n; i++) {
c.add(first.item); // In this order, in case add() throws.
collection.add(first.item); // In this order, in case add() throws.
unlinkFirst();
}
return n;
Expand Down

0 comments on commit 1f1d6c5

Please sign in to comment.