Rather than using Enumeration-related methods (*Element()), use
the methods provided by StringTokenizer (*Token()), which have
the same functionality, but are not down-casted to Object.
Change-Id: I5c0c258db8e70cafef058d628c20bf9cbeb26cb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
fe27f4e384d591021663abbcbfb505cc280c093b)
val StringTokenizer tokenizer = new StringTokenizer(formattedText, " ", true);
- while (tokenizer.hasMoreElements) {
- val nextElement = tokenizer.nextElement.toString
+ while (tokenizer.hasMoreTokens) {
+ val nextElement = tokenizer.nextToken
if (lineBuilder.length != 0 && lineBuilder.length + nextElement.length > 80) {
// FIXME: what tricks are we playing here? Equality probably does not trigger ever
sb.append(lineBuilder).append(NEW_LINE)
lineBuilder.setLength(0)
- if (nextElement.toString == ' ') {
+ if (nextElement == " ") {
isFirstElementOnNewLineEmptyChar = !isFirstElementOnNewLineEmptyChar;
}
}