Write an equals method for the Purse class
public boolean equals(Purse other)
that checks whether the other purse has the same coins in some order.

For example the purses

Purse[Quarter,Dime,Nickel,Dime]
and
Purse[Nickel,Dime,Dime,Quarter]
should be considered equal.

However the purses

Purse[Quarter,Dime,Nickel,Dime]
and
Purse[Nickel,Dime,Quarter,Quarter]
should NOT be considered equal.

Likewise

Purse[Dime,Nickel,Dime]
and
Purse[Quarter]
should NOT be considered equal either.

(You will probably need one or more helper methods.)

Here's how class Coin could look:

class Coin {
  Coin(String name, int value) {
    this.name = name;
    this.value = value;
  }
  String name;
  int value;
  boolean equals(Coin other) {
    return this.name.equals(other.name);
  }
  public String toString() {
    return this.name;
  }
}
Here's a possible Purse class:
import java.util.*;

class Purse {
  ArrayList contents;
  Purse() {
    this.contents = new ArrayList();
  }
  void add(Coin c) {
    this.contents.add(c);
  }
  public String toString() {
    String result = "[";
    for (int i = 0; i < this.contents.size(); i++) {
      result += this.contents.get(i)+ " ";
    }
    return result + "]";
  }
  // your method(s) would come here 
  Object pop() {
    return this.contents.remove(0);
  }
  boolean empty() {
    return this.contents.size() == 0;
  }
}
Remember you just need to write equals(...).