Question: Please write the following methods in Java, thank you. public MyDeque(MyDeque old) public boolean equals(MyDeque rhs) public String toString() The first method is a copy
Please write the following methods in Java, thank you.
public MyDeque(MyDequeold) public boolean equals(MyDeque rhs) public String toString()
The first method is a copy constructor, which should make a new MyDeque
The second method is an equals method that returns true if the deques are logically equivalent. In this case logically equivalent means that the individual items in both deques are equal() and in the same relative positions within the deques (based on front and back). However, they do not have to be located in the same index values in the arrays.
The third method is a toString() method which will make a and return single String of all the data in the MyDeque
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
