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


The following commit(s) were added to refs/heads/master by this push:
     new 8e4430c  Simplify conditions and avoid extra checks.
     new 55e666b  Merge pull request #242 from arturobernalg/feature/simply
8e4430c is described below

commit 8e4430c89f91ba7ff5b3e263470f70f0d27faa88
Author: Arturo Bernal <arturobern...@gmail.com>
AuthorDate: Sat Jun 19 10:26:39 2021 +0200

    Simplify conditions and avoid extra checks.
---
 src/main/java/org/apache/commons/text/WordUtils.java                    | 2 +-
 .../java/org/apache/commons/text/lookup/InterpolatorStringLookup.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/WordUtils.java 
b/src/main/java/org/apache/commons/text/WordUtils.java
index 7630696..dd4b448 100644
--- a/src/main/java/org/apache/commons/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/text/WordUtils.java
@@ -308,7 +308,7 @@ public class WordUtils {
                     Math.min((int) Math.min(Integer.MAX_VALUE, offset + 
wrapLength + 1L), inputLineLength)));
             if (matcher.find()) {
                 if (matcher.start() == 0) {
-                    matcherSize = matcher.end() - matcher.start();
+                    matcherSize = matcher.end();
                     if (matcherSize != 0) {
                         offset += matcher.end();
                         continue;
diff --git 
a/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java 
b/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
index 476ea14..9b88d80 100644
--- a/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
+++ b/src/main/java/org/apache/commons/text/lookup/InterpolatorStringLookup.java
@@ -88,7 +88,7 @@ class InterpolatorStringLookup extends AbstractStringLookup {
      * @param defaultMap the default map for string lookups.
      */
     <V> InterpolatorStringLookup(final Map<String, V> defaultMap) {
-        this(StringLookupFactory.INSTANCE.mapStringLookup(defaultMap == null ? 
new HashMap<String, V>() : defaultMap));
+        this(StringLookupFactory.INSTANCE.mapStringLookup(defaultMap == null ? 
new HashMap<>() : defaultMap));
     }
 
     /**

Reply via email to