diff options
author | Pacien TRAN-GIRARD | 2014-02-23 23:01:40 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-02-23 23:01:40 +0100 |
commit | ee5ec33aa48b334933b47079634e34cdd2f3b6c2 (patch) | |
tree | b4db383b11978b25dbc78e916c2c8159035758cd /src | |
parent | 6a11706b099d1dc2a18b139bfb256b50bddc22ff (diff) | |
download | esieequest-ee5ec33aa48b334933b47079634e34cdd2f3b6c2.tar.gz |
Use StringBuilder
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/CommandWords.java | 8 | ||||
-rw-r--r-- | src/esieequest/Room.java | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index c942043..e2d50f5 100644 --- a/src/esieequest/CommandWords.java +++ b/src/esieequest/CommandWords.java | |||
@@ -36,10 +36,10 @@ public class CommandWords { | |||
36 | * Print all valid commands to System.out. | 36 | * Print all valid commands to System.out. |
37 | */ | 37 | */ |
38 | public String getCommandList() { | 38 | public String getCommandList() { |
39 | String vCommands = ""; | 39 | StringBuilder vStrBuilder = new StringBuilder(); |
40 | for (String vCommand : this.sValidCommands) { | 40 | for (String vCommand : sValidCommands) { |
41 | vCommands += " " + vCommand; | 41 | vStrBuilder.append(" ").append(vCommand); |
42 | } | 42 | } |
43 | return vCommands; | 43 | return vStrBuilder.toString(); |
44 | } | 44 | } |
45 | } | 45 | } |
diff --git a/src/esieequest/Room.java b/src/esieequest/Room.java index 4626490..6d05b58 100644 --- a/src/esieequest/Room.java +++ b/src/esieequest/Room.java | |||
@@ -85,13 +85,13 @@ public class Room { | |||
85 | * @return A description of the available exits. | 85 | * @return A description of the available exits. |
86 | */ | 86 | */ |
87 | public String getExitString() { | 87 | public String getExitString() { |
88 | String vExitString = "Available exits:"; | 88 | StringBuilder vStrBuilder = new StringBuilder("Available exits:"); |
89 | Set<String> vKeys = this.aExits.keySet(); | 89 | Set<String> vKeys = this.aExits.keySet(); |
90 | for (Iterator<String> vIter = vKeys.iterator(); vIter.hasNext();) { | 90 | for (Iterator<String> vIter = vKeys.iterator(); vIter.hasNext();) { |
91 | vExitString += " " + vIter.next(); | 91 | vStrBuilder.append(" ").append(vIter.next()); |
92 | } | 92 | } |
93 | vExitString += "."; | 93 | vStrBuilder.append("."); |
94 | return vExitString; | 94 | return vStrBuilder.toString(); |
95 | } | 95 | } |
96 | 96 | ||
97 | } | 97 | } |