Java 类org.apache.commons.collections.BufferUnderflowException 实例源码

项目:vs.msc.ws14    文件:NullableCircularBuffer.java   
/**
 * Removes the least recently inserted element from this buffer.
 *
 * @return the least recently inserted element
 * @throws BufferUnderflowException
 *             if the buffer is empty
 */
public Object remove() {
    if (isEmpty()) {
        throw new BufferUnderflowException("The buffer is already empty");
    }

    Object element = elements[start];

    elements[start++] = null;

    if (start >= maxElements) {
        start = 0;
    }

    full = false;

    return element;
}
项目:vs.msc.ws14    文件:NullableCircularBuffer.java   
/**
 * Returns the least recently inserted element in this buffer.
 *
 * @return the least recently inserted element
 * @throws BufferUnderflowException
 *             if the buffer is empty
 */
public Object get() {
    if (isEmpty()) {
        throw new BufferUnderflowException("The buffer is already empty");
    }

    return elements[start];
}