commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pascalschumac...@apache.org
Subject [text] Made small code quality improvements. (closes #63)
Date Sat, 23 Sep 2017 19:39:40 GMT
Repository: commons-text
Updated Branches:
  refs/heads/master efcd2249f -> 5598109ef


Made small code quality improvements. (closes #63)


Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/5598109e
Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/5598109e
Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/5598109e

Branch: refs/heads/master
Commit: 5598109efb2365384b9a9110323ed9a7004cc905
Parents: efcd224
Author: Michael Hausegger <hausegger.michael@googlemail.com>
Authored: Wed Sep 20 20:03:24 2017 +0200
Committer: Pascal Schumacher <pascalschumacher@gmx.net>
Committed: Sat Sep 23 21:38:29 2017 +0200

----------------------------------------------------------------------
 .../java/org/apache/commons/text/RandomStringGenerator.java     | 2 +-
 src/main/java/org/apache/commons/text/WordUtils.java            | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-text/blob/5598109e/src/main/java/org/apache/commons/text/RandomStringGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index 7b70bae..f9819a1 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -171,7 +171,7 @@ public final class RandomStringGenerator {
 
         do {
             int codePoint;
-            if (characterList != null && characterList.size() > 0) {
+            if (characterList != null && !characterList.isEmpty()) {
                 codePoint = generateRandomNumber(characterList);
             } else {
                 codePoint = generateRandomNumber(minimumCodePoint, maximumCodePoint);

http://git-wip-us.apache.org/repos/asf/commons-text/blob/5598109e/src/main/java/org/apache/commons/text/WordUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/text/WordUtils.java b/src/main/java/org/apache/commons/text/WordUtils.java
index 3b8d7b7..6871467 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -614,10 +614,7 @@ public class WordUtils {
         for (int index = 0; index < strLen;) {
             final int oldCodepoint = str.codePointAt(index);
             final int newCodePoint;
-            if (Character.isUpperCase(oldCodepoint)) {
-                newCodePoint = Character.toLowerCase(oldCodepoint);
-                whitespace = false;
-            } else if (Character.isTitleCase(oldCodepoint)) {
+            if (Character.isUpperCase(oldCodepoint) || Character.isTitleCase(oldCodepoint))
{
                 newCodePoint = Character.toLowerCase(oldCodepoint);
                 whitespace = false;
             } else if (Character.isLowerCase(oldCodepoint)) {


Mime
View raw message