You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2021/04/19 22:24:03 UTC
[commons-text] 01/03: [TEXT-200] Simplify statements
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git
commit 77de407d9622b4da9ca7bb348a0ba96095413fa2
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Apr 18 12:55:20 2021 +0200
[TEXT-200] Simplify statements
---
src/main/java/org/apache/commons/text/CaseUtils.java | 5 +----
.../commons/text/translate/UnicodeUnpairedSurrogateRemover.java | 8 ++------
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/text/CaseUtils.java b/src/main/java/org/apache/commons/text/CaseUtils.java
index ccf902a..74cebf3 100644
--- a/src/main/java/org/apache/commons/text/CaseUtils.java
+++ b/src/main/java/org/apache/commons/text/CaseUtils.java
@@ -86,10 +86,7 @@ public class CaseUtils {
final int[] newCodePoints = new int[strLen];
int outOffset = 0;
final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
- boolean capitalizeNext = false;
- if (capitalizeFirstLetter) {
- capitalizeNext = true;
- }
+ boolean capitalizeNext = capitalizeFirstLetter;
for (int index = 0; index < strLen;) {
final int codePoint = str.codePointAt(index);
diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
index eea9ece..9d7c6c2 100644
--- a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
+++ b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
@@ -31,12 +31,8 @@ public class UnicodeUnpairedSurrogateRemover extends CodePointTranslator {
*/
@Override
public boolean translate(final int codepoint, final Writer writer) throws IOException {
- if (codepoint >= Character.MIN_SURROGATE && codepoint <= Character.MAX_SURROGATE) {
- // It's a surrogate. Write nothing and say we've translated.
- return true;
- }
- // It's not a surrogate. Don't translate it.
- return false;
+ // If true, it is a surrogate. Write nothing and say we've translated. Otherwise return false, and don't translate it.
+ return codepoint >= Character.MIN_SURROGATE && codepoint <= Character.MAX_SURROGATE;
}
}