Skip to content

Commit

Permalink
Use collector to build modifier String
Browse files Browse the repository at this point in the history
  • Loading branch information
Braunch committed Sep 6, 2016
1 parent 925e6d0 commit fc2b753
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Locale;
import java.util.stream.Collectors;

/**
* respond to grabKey and display the key binding
Expand Down Expand Up @@ -101,14 +102,7 @@ private String getModifierText(KeyEvent evt) {
modifiersList.add("meta");
}
//Now build the String with all the modifier texts
String modifiersAsString = "";
for (String s : modifiersList) {
//add a spacing if its not the first modifier to be added
if (!"".equals(modifiersAsString)) {
modifiersAsString += " ";
}
modifiersAsString += s;
}
String modifiersAsString = modifiersList.stream().collect(Collectors.joining(" "));
return modifiersAsString;
}
}

0 comments on commit fc2b753

Please sign in to comment.