//to represent a nonempty list of phone entries public class ConsPhList implements IPhList { public PhEntry first; public IPhList rest; public ConsPhList(PhEntry first, IPhList rest){ this.first = first; this.rest = rest; } // represent this list as a string public String toString(){ return new String("new ConsPhList(" + "first: "+ this.first.toString() + ",\n" + "rest: "+ this.rest.toString() + ")"); } //remove the first phone entry with the given name from this list public IPhList remove(String name){ if (name.equals(this.first.name)) return this.rest; else return new ConsPhList(this.first,this.rest.remove(name)); } }