package com.javaranch.newsletter.aug03.digester; import java.util.ArrayList; import java.util.List; public class Book { private String title; private ArrayList editions = new ArrayList(); public Book() { } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public List getEditions() { return editions; } public void addEdition(Edition edition) { editions.add(edition); } public String toString() { String newline = System.getProperty("line.separator"); StringBuffer sb = new StringBuffer(); sb.append(" " + newline); sb.append(" " + title + "" + newline); java.util.Iterator editionsIt = editions.iterator(); while (editionsIt.hasNext()) { sb.append(editionsIt.next().toString()); } sb.append(" " + newline); return sb.toString(); } }