File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
serialized-lob/src/main/java/com/iluwatar/slob/lob Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 4848public class Forest implements Serializable {
4949
5050 private String name ;
51+ private String NEWLINE = "\n --------------------------\n " ;
5152 private Set <Animal > animals = new HashSet <>();
5253 private Set <Plant > plants = new HashSet <>();
5354
@@ -105,16 +106,16 @@ public String toString() {
105106 sb .append ("Forest Name = " ).append (name ).append ("\n " );
106107 sb .append ("Animals found in the " ).append (name ).append (" Forest: \n " );
107108 for (Animal animal : animals ) {
108- sb .append (" \n -------------------------- \n " );
109+ sb .append (NEWLINE );
109110 sb .append (animal .toString ());
110- sb .append (" \n -------------------------- \n " );
111+ sb .append (NEWLINE );
111112 }
112113 sb .append ("\n " );
113114 sb .append ("Plants in the " ).append (name ).append (" Forest: \n " );
114115 for (Plant plant : plants ) {
115- sb .append (" \n -------------------------- \n " );
116+ sb .append (NEWLINE );
116117 sb .append (plant .toString ());
117- sb .append (" \n -------------------------- \n " );
118+ sb .append (NEWLINE );
118119 }
119120 return sb .toString ();
120121 }
You can’t perform that action at this time.
0 commit comments