X Tutup
Skip to content

Commit bc06030

Browse files
author
mafagafogigante
committed
Improves a toString method.
Makes it more readable and deletes an useless semicolon.
1 parent a4637fc commit bc06030

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

mediator/src/main/java/com/iluwatar/Action.java

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,16 @@ public enum Action {
66

77
public String toString() {
88

9-
String s = "";
109
switch (this) {
1110
case ENEMY:
12-
s = "spotted enemies";
13-
break;
11+
return "spotted enemies";
1412
case GOLD:
15-
s = "found gold";
16-
break;
13+
return "found gold";
1714
case HUNT:
18-
s = "hunted a rabbit";
19-
break;
15+
return "hunted a rabbit";
2016
case TALE:
21-
s = "tells a tale";
22-
break;
23-
default:
24-
break;
17+
return "tells a tale";
2518
}
26-
return s;
27-
};
19+
return "";
20+
}
2821
}

0 commit comments

Comments
 (0)
X Tutup