Question
Can anyone finish all of my methods for me here is my code below import java.util.ArrayList; import java.util.Collection; import java.util.Deque; import java.util.Iterator; public class FixedSizedDeque
Can anyone finish all of my methods for me here is my code below
import java.util.ArrayList;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
public class FixedSizedDeque
public static void main(String args[]) { FixedSizedDeque
ArrayList
int size;
public FixedSizedDeque(int maxSize) {
//TODO
deQueue = new ArrayList<>();
size = 0;
}
@Override
public boolean addAll(Collection extends T> arg0) {
return false;
}
@Override
public void clear() {
deQueue.clear();
}
@Override
public boolean containsAll(Collection> arg0) {
return deQueue.containsAll(arg0);
}
@Override
public boolean isEmpty() {
return size == 0;
}
@Override
public boolean removeAll(Collection> arg0) {
return deQueue.removeAll(arg0);
}
@Override
public boolean retainAll(Collection> arg0) {
return deQueue.retainAll(arg0);
}
@Override
public Object[] toArray() {
return deQueue.toArray();
}
@SuppressWarnings("hiding")
@Override
public
return deQueue.toArray(arg0);
}
@Override
public boolean add(T arg0) {
boolean res = deQueue.add(arg0);
if(res)
size++;
return res;
}
@Override
public void addFirst(T arg0) {
deQueue.add(0, arg0);
size++;
}
@Override
public void addLast(T arg0) {
add(arg0);
}
@Override
public boolean contains(Object arg0) {
return deQueue.contains(arg0);
}
@Override
public Iterator
return deQueue.iterator();
}
@Override
public T element() {
return null;
}
@Override
public T getFirst() {
return null;
}
@Override
public T getLast() {
return null;
}
@Override
public Iterator
return null;
}
@Override
public boolean offer(T arg0) {
return add(arg0);
}
@Override
public boolean offerFirst(T arg0) {
addFirst(arg0);
return true;
}
@Override
public boolean offerLast(T arg0) {
addLast(arg0);
return true;
}
@Override
public T peek() {
return null;
}
@Override
public T peekFirst() {
return null;
}
@Override
public T peekLast() {
return null;
}
@Override
public T poll() {
return null;
}
@Override
public T pollFirst() {
return null;
}
@Override
public T pollLast() {
return null;
}
@Override
public T pop() {
return null;
}
@Override
public void push(T arg0) {
}
@Override
public T remove() {
return null;
}
@Override
public boolean remove(Object arg0) {
return false;
}
@Override
public T removeFirst() {
return deQueue.remove(0);
}
@Override
public boolean removeFirstOccurrence(Object arg0) {
return false;
}
@Override
public T removeLast() {
return deQueue.remove(size-1);
}
@Override
public boolean removeLastOccurrence(Object arg0) {
return false;
}
@Override
public int size() {
return size;
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started