public class FancyStackDeque extends StackDeque implements FancyCollection { //Constructors public FancyStackDeque() { ... } public FancyStackDeque(Object[] arg) { ... } public FancyStackDeque(FancyCollection arg) { ... } //Methods - inherited from class StackDeque //FancyCollection methods implementation public int size() { ... } public void clear() { left.clear(); right.clear(); } public boolean contains(Object arg) { ... } public Object clone() { ... } //Override methods - inherited from class Object public boolean equals(Object arg) { FancyStackDeque d = (FancyStackDeque)arg; if(this.size() != d.size()) return false; Object[] thisArray = this.toArray(); Object[] argArray = d.toArray(); //Proverka dali thisArray i argArray savpadat ... } public String toString() { Object[] temp = this.toArray(); //Polu4avane na niz ot elementite na temp ... } }