Merge pull request #242 from arturobernalg/feature/simply
Simplify conditions and avoid extra checks.
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 @@
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 @@
* @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));
}
/**