/** * Removes the first element from the front of the index if its not empty. * @return True if the element was removed or false if the index was empty. */ public boolean removeFirst() { // check if queue is empty if (isEmpty()) { return false; } // increment first item, rollver to beginning if needed first = calculateNewIndex(first, 1); //first = (first + 1) % capacity; // always decrement size size--; // check if we should reset checkReset(); return true; }
/** * Removes the last element from the back of the index if its not empty. * @return True if the element was removed or false if the index was empty. */ public boolean removeLast() { // check if queue is empty if (isEmpty()) { return false; } // increment first item, rollver to beginning if needed next = calculateNewIndex(next, -1); //next = (next - 1) % capacity; // always decrement size size--; // check if we should reset checkReset(); return true; }
/** * Removes the last element from the back of the index if its not empty. * @return True if the element was removed or false if the index was empty. */ public boolean removeLast() { // check if queue is empty if (isEmpty()) { return false; } // increment first item, rollver to beginning if needed next = calculateNewIndex(next, -1); //next = (next - 1) % capacity; // always decrement size size--; // check if we should reset checkReset(); return true; }
/** * Removes the first element from the front of the index if its not empty. * @return True if the element was removed or false if the index was empty. */ public boolean removeFirst() { // check if queue is empty if (isEmpty()) { return false; } // increment first item, rollver to beginning if needed first = calculateNewIndex(first, 1); //first = (first + 1) % capacity; // always decrement size size--; // check if we should reset checkReset(); return true; }