//to represent a nonempty list of ImageFile objects public class ConsListImageFile implements IListImageFile{ public ImageFile first; public IListImageFile rest; public ConsListImageFile(ImageFile first, IListImageFile rest){ this.first=first; this.rest=rest; } //does this non-empty list contain that ImageFile public boolean contains(ImageFile that){ return this.first.sameImageFile(that) || this.rest.contains(that); } }