Clears the queue of all the items and closes it, preventing any new writes from being added.

@return A new List with the contents of the queue (prior to cleanup), in the same order.
171764
synchronized List<Write> close() {
        List<Write> items = new ArrayList<>(this.writes);
        this.writes.clear();
        this.totalLength = 0;
        this.closed = true;
        return items;
    }
1122024
public void clear() {
    // Clears all keys, values and buckets linked lists.
    for (EntryImpl<K, V> entry = _mapFirst; entry != null; entry = entry._after) {
      entry._key = null;
      entry._value = null;
      entry._before = null;
      entry._next = null;
      if (entry._previous == null) { // First in bucket.
        _entries[entry._index] = null;
      } else {
        entry._previous = null;
      }
    }

    // Recycles all entries.
    if (_mapLast != null) {
      _mapLast._after = _poolFirst; // Connects to pool.
      _poolFirst = _mapFirst;
      _mapFirst = null;
      _mapLast = null;
      _size = 0;
      sizeChanged();
    }
  }
540535
public ReportRequest[] clear() {
    if (cache == null) {
      return NO_REQUESTS;
    }
    synchronized (cache) {
      ReportRequest[] res = generatedFlushRequests(cache.asMap().values());
      cache.invalidateAll();
      out.clear();
      return res;
    }
  }
1301283
public Collection<Operation> destroyInputQueue() {
    Collection<Operation> rv = new ArrayList<Operation>();
    inputQueue.drainTo(rv);
    return rv;
  }
539694
public synchronized List<PrioritizedSplitRunner> destroy()
    {
        destroyed = true;

        ImmutableList.Builder<PrioritizedSplitRunner> builder = ImmutableList.builder();
        builder.addAll(runningIntermediateSplits);
        builder.addAll(runningLeafSplits);
        builder.addAll(queuedLeafSplits);
        runningIntermediateSplits.clear();
        runningLeafSplits.clear();
        queuedLeafSplits.clear();
        return builder.build();
    }
263555
@SuppressWarnings("unchecked")
  public T clearQueue(String name) {
    for (Element e : elements()) {
      queue(e, name, null).clear();
    }
    return (T) this;
  }
127543
Collection<AsteriskQueue> getQueues()
    {
        refreshQueuesIfForced();

        Collection<AsteriskQueue> copy;

        synchronized (queuesLRU)
        {
            copy = new ArrayList<AsteriskQueue>(queuesLRU.values());
        }
        return copy;
    }
857045
public synchronized T pop() {
		if( list.isEmpty() ) {
			return factory.newInstance();
		} else {
			return list.remove(list.size()-1);
		}
	}
264831
@Override
	public List<MemorySegment> close() throws IOException {
		if (this.closed) {
			throw new IllegalStateException("Already closed.");
		}
		this.closed = true;

		// re-collect all memory segments
		ArrayList<MemorySegment> list = this.freeMem;
		final MemorySegment current = getCurrentSegment();
		if (current != null) {
			list.add(current);
		}
		clear();

		// close the writer and gather all segments
		final LinkedBlockingQueue<MemorySegment> queue = this.reader.getReturnQueue();
		this.reader.close();

		while (list.size() < this.numSegments) {
			final MemorySegment m = queue.poll();
			if (m == null) {
				// we get null if the queue is empty. that should not be the case if the reader was properly closed.
				throw new RuntimeException("Bug in ChannelReaderInputView: MemorySegments lost.");
			}
			list.add(m);
		}
		return list;
	}
917278
public function clear(): QueueInterface
    {
        $positions = [];
        $max = $this->count();
        for ($i = 0; $i < $max; $i++) {
            $positions[] = $i;
        }
        $this->removeTracks($positions);

        return $this;
    }
800160
public ArrayList<MemorySegment> resetOverflowBuckets() {
		this.numOverflowSegments = 0;
		this.nextOverflowBucket = 0;
		
		ArrayList<MemorySegment> result = new ArrayList<MemorySegment>(this.overflowSegments.length);
		for(int i = 0; i < this.overflowSegments.length; i++) {
			if(this.overflowSegments[i] != null) {
				result.add(this.overflowSegments[i]);
			}
		}
		this.overflowSegments = new MemorySegment[2];
		return result;
	}
661593
public CheckRequest[] flush() {
    if (cache == null) {
      return NO_REQUESTS;
    }

    // Thread safety - the current thread cleans up the cache, which may add multiple cached
    // aggregated operations to the output deque.
    synchronized (cache) {
      cache.cleanUp();
      ArrayList<CheckRequest> reqs = Lists.newArrayList();
      for (CachedItem item : out) {
        CheckRequest req = item.extractRequest();
        if (req != null) {
          reqs.add(req);
        }
      }
      out.clear();
      return reqs.toArray(new CheckRequest[reqs.size()]);
    }
  }
204412
public function clear()
    {
        $this->items  = [];
        $this->serial = 0;
        $this->count  = 0;
        $this->sorted = false;
    }
1104142
void clear() {
    for(int i=0; i<LEVEL; i++) {
      priorityQueues.get(i).clear();
    }
    raidQueue.clear();
  }
1015939
public void clear() {
        Node<T> node = head.next, next;
        size = 0;
        head.reset(); // Clearing references.
        tail = head;
        iterator.currentNode = head;
        while (node != null) {
            next = node.next;
            node.free(pool);
            node = next;
        }
    }
1026605
@Override
	public List<MemorySegment> dispose() {
		this.freeMemory.addAll(this.sortIndex);
		this.freeMemory.addAll(this.recordBufferSegments);
		
		this.recordBufferSegments.clear();
		this.sortIndex.clear();
		
		return this.freeMemory;
	}
695947
public DrawerView clearItems() {
        for (DrawerItem item : mAdapter.getItems()) {
            item.detach();
        }
        mAdapter.clear();
        updateList();
        return this;
    }