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