commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject [lang] [GitHub] commons-lang pull request #276: IntelliJ IDEA refactorings. Closes #276.
Date Wed, 12 Jul 2017 07:09:44 GMT
Repository: commons-lang
Updated Branches:
  refs/heads/master a37d19eb4 -> 1571050a1


[GitHub] commons-lang pull request #276: IntelliJ IDEA refactorings.
Closes #276.

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/1571050a
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/1571050a
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/1571050a

Branch: refs/heads/master
Commit: 1571050a196198f336ae487ee3b6df629d3ee9da
Parents: a37d19e
Author: Jonathan Bluett-Duncan <jbluettduncan@gmail.com>
Authored: Wed Jul 12 00:09:41 2017 -0700
Committer: Gary Gregory <ggregory@apache.org>
Committed: Wed Jul 12 00:09:41 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/commons/lang3/CharSet.java  |  2 +-
 .../org/apache/commons/lang3/CharUtils.java     | 16 +++----
 .../org/apache/commons/lang3/ClassUtils.java    |  6 +--
 .../org/apache/commons/lang3/LocaleUtils.java   | 14 +++---
 .../org/apache/commons/lang3/ObjectUtils.java   |  2 +-
 .../org/apache/commons/lang3/StringUtils.java   | 45 +++++++++-----------
 .../java/org/apache/commons/lang3/Validate.java | 24 +++++------
 .../commons/lang3/builder/CompareToBuilder.java |  2 +-
 .../builder/ReflectionToStringBuilder.java      |  2 +-
 .../commons/lang3/builder/ToStringStyle.java    |  4 +-
 .../concurrent/EventCountCircuitBreaker.java    |  3 +-
 .../commons/lang3/exception/ExceptionUtils.java |  6 +--
 .../org/apache/commons/lang3/math/Fraction.java |  2 +-
 .../commons/lang3/mutable/MutableBoolean.java   |  4 +-
 .../commons/lang3/reflect/FieldUtils.java       |  5 +--
 .../commons/lang3/reflect/TypeLiteral.java      |  2 +-
 .../apache/commons/lang3/text/StrTokenizer.java |  5 +--
 .../commons/lang3/time/FastDateFormat.java      |  2 +-
 .../commons/lang3/time/FastDatePrinter.java     |  2 +-
 .../org/apache/commons/lang3/tuple/Pair.java    |  2 +-
 20 files changed, 67 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/CharSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSet.java b/src/main/java/org/apache/commons/lang3/CharSet.java
index 70f9509..cbb221d 100644
--- a/src/main/java/org/apache/commons/lang3/CharSet.java
+++ b/src/main/java/org/apache/commons/lang3/CharSet.java
@@ -263,7 +263,7 @@ public class CharSet implements Serializable {
         if (obj == this) {
             return true;
         }
-        if (obj instanceof CharSet == false) {
+        if (!(obj instanceof CharSet)) {
             return false;
         }
         final CharSet other = (CharSet) obj;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/CharUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharUtils.java b/src/main/java/org/apache/commons/lang3/CharUtils.java
index 51b347a..219dea2 100644
--- a/src/main/java/org/apache/commons/lang3/CharUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharUtils.java
@@ -218,7 +218,7 @@ public class CharUtils {
      * @throws IllegalArgumentException if the character is not ASCII numeric
      */
     public static int toIntValue(final char ch) {
-        if (isAsciiNumeric(ch) == false) {
+        if (!isAsciiNumeric(ch)) {
             throw new IllegalArgumentException("The character " + ch + " is not in the range
'0' - '9'");
         }
         return ch - 48;
@@ -240,7 +240,7 @@ public class CharUtils {
      * @return the int value of the character
      */
     public static int toIntValue(final char ch, final int defaultValue) {
-        if (isAsciiNumeric(ch) == false) {
+        if (!isAsciiNumeric(ch)) {
             return defaultValue;
         }
         return ch - 48;
@@ -351,13 +351,11 @@ public class CharUtils {
      * @return the escaped Unicode string
      */
     public static String unicodeEscaped(final char ch) {
-        final StringBuilder sb = new StringBuilder(6);
-        sb.append("\\u");
-        sb.append(HEX_DIGITS[(ch >> 12) & 15]);
-        sb.append(HEX_DIGITS[(ch >> 8) & 15]);
-        sb.append(HEX_DIGITS[(ch >> 4) & 15]);
-        sb.append(HEX_DIGITS[(ch) & 15]);
-        return sb.toString();
+        return "\\u" +
+            HEX_DIGITS[(ch >> 12) & 15] +
+            HEX_DIGITS[(ch >> 8) & 15] +
+            HEX_DIGITS[(ch >> 4) & 15] +
+            HEX_DIGITS[(ch) & 15];
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/ClassUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ClassUtils.java b/src/main/java/org/apache/commons/lang3/ClassUtils.java
index e0b4d72..c294f67 100644
--- a/src/main/java/org/apache/commons/lang3/ClassUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ClassUtils.java
@@ -607,7 +607,7 @@ public class ClassUtils {
      * @return {@code true} if assignment possible
      */
     public static boolean isAssignable(Class<?>[] classArray, Class<?>[] toClassArray,
final boolean autoboxing) {
-        if (ArrayUtils.isSameLength(classArray, toClassArray) == false) {
+        if (!ArrayUtils.isSameLength(classArray, toClassArray)) {
             return false;
         }
         if (classArray == null) {
@@ -617,7 +617,7 @@ public class ClassUtils {
             toClassArray = ArrayUtils.EMPTY_CLASS_ARRAY;
         }
         for (int i = 0; i < classArray.length; i++) {
-            if (isAssignable(classArray[i], toClassArray[i], autoboxing) == false) {
+            if (!isAssignable(classArray[i], toClassArray[i], autoboxing)) {
                 return false;
             }
         }
@@ -744,7 +744,7 @@ public class ClassUtils {
             return true;
         }
         if (cls.isPrimitive()) {
-            if (toClass.isPrimitive() == false) {
+            if (!toClass.isPrimitive()) {
                 return false;
             }
             if (Integer.TYPE.equals(cls)) {

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
index 51bbf5f..cd11781 100644
--- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
@@ -233,7 +233,7 @@ public class LocaleUtils {
             if (locale.getCountry().length() > 0) {
                 list.add(new Locale(locale.getLanguage(), StringUtils.EMPTY));
             }
-            if (list.contains(defaultLocale) == false) {
+            if (!list.contains(defaultLocale)) {
                 list.add(defaultLocale);
             }
         }
@@ -297,10 +297,9 @@ public class LocaleUtils {
         if (langs == null) {
             langs = new ArrayList<>();
             final List<Locale> locales = availableLocaleList();
-            for (int i = 0; i < locales.size(); i++) {
-                final Locale locale = locales.get(i);
+            for (final Locale locale : locales) {
                 if (countryCode.equals(locale.getCountry()) &&
-                        locale.getVariant().isEmpty()) {
+                    locale.getVariant().isEmpty()) {
                     langs.add(locale);
                 }
             }
@@ -329,11 +328,10 @@ public class LocaleUtils {
         if (countries == null) {
             countries = new ArrayList<>();
             final List<Locale> locales = availableLocaleList();
-            for (int i = 0; i < locales.size(); i++) {
-                final Locale locale = locales.get(i);
+            for (final Locale locale : locales) {
                 if (languageCode.equals(locale.getLanguage()) &&
-                        locale.getCountry().length() != 0 &&
-                        locale.getVariant().isEmpty()) {
+                    locale.getCountry().length() != 0 &&
+                    locale.getVariant().isEmpty()) {
                     countries.add(locale);
                 }
             }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/ObjectUtils.java b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
index 5d86293..1ec0956 100644
--- a/src/main/java/org/apache/commons/lang3/ObjectUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ObjectUtils.java
@@ -251,7 +251,7 @@ public class ObjectUtils {
      * @return {@code false} if the values of both objects are the same
      */
     public static boolean notEqual(final Object object1, final Object object2) {
-        return ObjectUtils.equals(object1, object2) == false;
+        return !ObjectUtils.equals(object1, object2);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/StringUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index 97a073f..4af966e 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -338,7 +338,7 @@ public class StringUtils {
             return true;
         }
         for (int i = 0; i < strLen; i++) {
-            if (Character.isWhitespace(cs.charAt(i)) == false) {
+            if (!Character.isWhitespace(cs.charAt(i))) {
                 return false;
             }
         }
@@ -4611,8 +4611,7 @@ public class StringUtils {
         }
         final Object first = iterator.next();
         if (!iterator.hasNext()) {
-            final String result = Objects.toString(first, "");
-            return result;
+            return Objects.toString(first, "");
         }
 
         // two or more elements
@@ -4656,8 +4655,7 @@ public class StringUtils {
         }
         final Object first = iterator.next();
         if (!iterator.hasNext()) {
-            final String result = Objects.toString(first, "");
-            return result;
+            return Objects.toString(first, "");
         }
 
         // two or more elements
@@ -5981,11 +5979,9 @@ public class StringUtils {
             start = end;
             end = temp;
         }
-        return new StringBuilder(len + start - end + overlay.length() + 1)
-            .append(str.substring(0, start))
-            .append(overlay)
-            .append(str.substring(end))
-            .toString();
+        return str.substring(0, start) +
+            overlay +
+            str.substring(end);
     }
 
     // Chomping
@@ -6927,7 +6923,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isLetter(cs.charAt(i)) == false) {
+            if (!Character.isLetter(cs.charAt(i))) {
                 return false;
             }
         }
@@ -6962,7 +6958,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isLetter(cs.charAt(i)) == false && cs.charAt(i) != ' ')
{
+            if (!Character.isLetter(cs.charAt(i)) && cs.charAt(i) != ' ') {
                 return false;
             }
         }
@@ -6997,7 +6993,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isLetterOrDigit(cs.charAt(i)) == false) {
+            if (!Character.isLetterOrDigit(cs.charAt(i))) {
                 return false;
             }
         }
@@ -7032,7 +7028,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isLetterOrDigit(cs.charAt(i)) == false && cs.charAt(i)
!= ' ') {
+            if (!Character.isLetterOrDigit(cs.charAt(i)) && cs.charAt(i) != ' ')
{
                 return false;
             }
         }
@@ -7071,7 +7067,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (CharUtils.isAsciiPrintable(cs.charAt(i)) == false) {
+            if (!CharUtils.isAsciiPrintable(cs.charAt(i))) {
                 return false;
             }
         }
@@ -7154,7 +7150,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isDigit(cs.charAt(i)) == false && cs.charAt(i) != ' ')
{
+            if (!Character.isDigit(cs.charAt(i)) && cs.charAt(i) != ' ') {
                 return false;
             }
         }
@@ -7226,7 +7222,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isWhitespace(cs.charAt(i)) == false) {
+            if (!Character.isWhitespace(cs.charAt(i))) {
                 return false;
             }
         }
@@ -7261,7 +7257,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isLowerCase(cs.charAt(i)) == false) {
+            if (!Character.isLowerCase(cs.charAt(i))) {
                 return false;
             }
         }
@@ -7296,7 +7292,7 @@ public class StringUtils {
         }
         final int sz = cs.length();
         for (int i = 0; i < sz; i++) {
-            if (Character.isUpperCase(cs.charAt(i)) == false) {
+            if (!Character.isUpperCase(cs.charAt(i))) {
                 return false;
             }
         }
@@ -7761,12 +7757,9 @@ public class StringUtils {
         final int startOffset = targetSting/2+targetSting%2;
         final int endOffset = str.length()-targetSting/2;
 
-        final StringBuilder builder = new StringBuilder(length);
-        builder.append(str.substring(0,startOffset));
-        builder.append(middle);
-        builder.append(str.substring(endOffset));
-
-        return builder.toString();
+        return str.substring(0, startOffset) +
+            middle +
+            str.substring(endOffset);
     }
 
     // Difference
@@ -9212,7 +9205,7 @@ public class StringUtils {
         if (str.charAt(0) == wrapChar && str.charAt(str.length() - 1) == wrapChar)
{
             final int startIndex = 0;
             final int endIndex = str.length() - 1;
-            if (startIndex != -1 && endIndex != -1) {
+            if (endIndex != -1) {
                 return str.substring(startIndex + 1, endIndex);
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/Validate.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/Validate.java b/src/main/java/org/apache/commons/lang3/Validate.java
index fc52cb4..0f003fd 100644
--- a/src/main/java/org/apache/commons/lang3/Validate.java
+++ b/src/main/java/org/apache/commons/lang3/Validate.java
@@ -105,7 +105,7 @@ public class Validate {
      * @see #isTrue(boolean, String, Object...)
      */
     public static void isTrue(final boolean expression, final String message, final long
value) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalArgumentException(String.format(message, Long.valueOf(value)));
         }
     }
@@ -130,7 +130,7 @@ public class Validate {
      * @see #isTrue(boolean, String, Object...)
      */
     public static void isTrue(final boolean expression, final String message, final double
value) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalArgumentException(String.format(message, Double.valueOf(value)));
         }
     }
@@ -154,7 +154,7 @@ public class Validate {
      * @see #isTrue(boolean, String, double)
      */
     public static void isTrue(final boolean expression, final String message, final Object...
values) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalArgumentException(String.format(message, values));
         }
     }
@@ -179,7 +179,7 @@ public class Validate {
      * @see #isTrue(boolean, String, Object...)
      */
     public static void isTrue(final boolean expression) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalArgumentException(DEFAULT_IS_TRUE_EX_MESSAGE);
         }
     }
@@ -803,7 +803,7 @@ public class Validate {
      * @since 3.0
      */
     public static void validState(final boolean expression) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalStateException(DEFAULT_VALID_STATE_EX_MESSAGE);
         }
     }
@@ -825,7 +825,7 @@ public class Validate {
      * @since 3.0
      */
     public static void validState(final boolean expression, final String message, final Object...
values) {
-        if (expression == false) {
+        if (!expression) {
             throw new IllegalStateException(String.format(message, values));
         }
     }
@@ -850,7 +850,7 @@ public class Validate {
      */
     public static void matchesPattern(final CharSequence input, final String pattern) {
         // TODO when breaking BC, consider returning input
-        if (Pattern.matches(pattern, input) == false) {
+        if (!Pattern.matches(pattern, input)) {
             throw new IllegalArgumentException(String.format(DEFAULT_MATCHES_PATTERN_EX,
input, pattern));
         }
     }
@@ -874,7 +874,7 @@ public class Validate {
      */
     public static void matchesPattern(final CharSequence input, final String pattern, final
String message, final Object... values) {
         // TODO when breaking BC, consider returning input
-        if (Pattern.matches(pattern, input) == false) {
+        if (!Pattern.matches(pattern, input)) {
             throw new IllegalArgumentException(String.format(message, values));
         }
     }
@@ -1259,7 +1259,7 @@ public class Validate {
      */
     public static void isInstanceOf(final Class<?> type, final Object obj) {
         // TODO when breaking BC, consider returning obj
-        if (type.isInstance(obj) == false) {
+        if (!type.isInstance(obj)) {
             throw new IllegalArgumentException(String.format(DEFAULT_IS_INSTANCE_OF_EX_MESSAGE,
type.getName(),
                     obj == null ? "null" : obj.getClass().getName()));
         }
@@ -1284,7 +1284,7 @@ public class Validate {
      */
     public static void isInstanceOf(final Class<?> type, final Object obj, final String
message, final Object... values) {
         // TODO when breaking BC, consider returning obj
-        if (type.isInstance(obj) == false) {
+        if (!type.isInstance(obj)) {
             throw new IllegalArgumentException(String.format(message, values));
         }
     }
@@ -1310,7 +1310,7 @@ public class Validate {
      */
     public static void isAssignableFrom(final Class<?> superType, final Class<?>
type) {
         // TODO when breaking BC, consider returning type
-        if (superType.isAssignableFrom(type) == false) {
+        if (!superType.isAssignableFrom(type)) {
             throw new IllegalArgumentException(String.format(DEFAULT_IS_ASSIGNABLE_EX_MESSAGE,
type == null ? "null" : type.getName(),
                     superType.getName()));
         }
@@ -1335,7 +1335,7 @@ public class Validate {
      */
     public static void isAssignableFrom(final Class<?> superType, final Class<?>
type, final String message, final Object... values) {
         // TODO when breaking BC, consider returning type
-        if (superType.isAssignableFrom(type) == false) {
+        if (!superType.isAssignableFrom(type)) {
             throw new IllegalArgumentException(String.format(message, values));
         }
     }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
index 4a0a1d1..0884543 100644
--- a/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/CompareToBuilder.java
@@ -600,7 +600,7 @@ public class CompareToBuilder implements Builder<Integer> {
         if (lhs == rhs) {
             return this;
         }
-        if (lhs == false) {
+        if (!lhs) {
             comparison = -1;
         } else {
             comparison = +1;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
index 12e410d..c59fcec 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ReflectionToStringBuilder.java
@@ -806,7 +806,7 @@ public class ReflectionToStringBuilder extends ToStringBuilder {
     public void setUpToClass(final Class<?> clazz) {
         if (clazz != null) {
             final Object object = getObject();
-            if (object != null && clazz.isInstance(object) == false) {
+            if (object != null && !clazz.isInstance(object)) {
                 throw new IllegalArgumentException("Specified class is not a superclass of
the object");
             }
         }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
index 375efb7..f40ecce 100644
--- a/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
+++ b/src/main/java/org/apache/commons/lang3/builder/ToStringStyle.java
@@ -422,7 +422,7 @@ public abstract class ToStringStyle implements Serializable {
      *  <code>toString</code> for.
      */
     public void appendEnd(final StringBuffer buffer, final Object object) {
-        if (this.fieldSeparatorAtEnd == false) {
+        if (!this.fieldSeparatorAtEnd) {
             removeLastFieldSeparator(buffer);
         }
         appendContentEnd(buffer);
@@ -2607,7 +2607,7 @@ public abstract class ToStringStyle implements Serializable {
          * @param value the value to append.
          */
         private void appendValueAsString(final StringBuffer buffer, final String value) {
-            buffer.append("\"" + value + "\"");
+            buffer.append('"').append(value).append('"');
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
index 1cc9eeb..b40213e 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/EventCountCircuitBreaker.java
@@ -405,8 +405,7 @@ public class EventCountCircuitBreaker extends AbstractCircuitBreaker<Integer>
{
      * @throws CircuitBreakingException if the strategy cannot be resolved
      */
     private static StateStrategy stateStrategy(final State state) {
-        final StateStrategy strategy = STRATEGY_MAP.get(state);
-        return strategy;
+        return STRATEGY_MAP.get(state);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
index 8fc750b..f1a7f87 100644
--- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
+++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java
@@ -278,7 +278,7 @@ public class ExceptionUtils {
      */
     public static List<Throwable> getThrowableList(Throwable throwable) {
         final List<Throwable> list = new ArrayList<>();
-        while (throwable != null && list.contains(throwable) == false) {
+        while (throwable != null && !list.contains(throwable)) {
             list.add(throwable);
             throwable = ExceptionUtils.getCause(throwable);
         }
@@ -527,9 +527,7 @@ public class ExceptionUtils {
             } else {
                 frames.add(WRAPPED_MARKER + throwables[i].toString());
             }
-            for (int j = 0; j < trace.size(); j++) {
-                frames.add(trace.get(j));
-            }
+            frames.addAll(trace);
         }
         return frames.toArray(new String[frames.size()]);
     }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/math/Fraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/math/Fraction.java b/src/main/java/org/apache/commons/lang3/math/Fraction.java
index e59789d..0ce5bed 100644
--- a/src/main/java/org/apache/commons/lang3/math/Fraction.java
+++ b/src/main/java/org/apache/commons/lang3/math/Fraction.java
@@ -827,7 +827,7 @@ public final class Fraction extends Number implements Comparable<Fraction>
{
         if (obj == this) {
             return true;
         }
-        if (obj instanceof Fraction == false) {
+        if (!(obj instanceof Fraction)) {
             return false;
         }
         final Fraction other = (Fraction) obj;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
index 1aec693..af13516 100644
--- a/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
+++ b/src/main/java/org/apache/commons/lang3/mutable/MutableBoolean.java
@@ -126,7 +126,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable,
Comparabl
      * @since 2.5
      */
     public boolean isTrue() {
-        return value == true;
+        return value;
     }
 
     /**
@@ -136,7 +136,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable,
Comparabl
      * @since 2.5
      */
     public boolean isFalse() {
-        return value == false;
+        return !value;
     }
 
     //-----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
index aa2287a..c4cccca 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java
@@ -24,6 +24,7 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -215,9 +216,7 @@ public class FieldUtils {
         Class<?> currentClass = cls;
         while (currentClass != null) {
             final Field[] declaredFields = currentClass.getDeclaredFields();
-            for (final Field field : declaredFields) {
-                allFields.add(field);
-            }
+            Collections.addAll(allFields, declaredFields);
             currentClass = currentClass.getSuperclass();
         }
         return allFields;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java b/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
index db801fc..cef7ebd 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/TypeLiteral.java
@@ -99,7 +99,7 @@ public abstract class TypeLiteral<T> implements Typed<T> {
         if (obj == this) {
             return true;
         }
-        if (obj instanceof TypeLiteral == false) {
+        if (!(obj instanceof TypeLiteral)) {
             return false;
         }
         final TypeLiteral<?> other = (TypeLiteral<?>) obj;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
index f9fb6dc..e321934 100644
--- a/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
+++ b/src/main/java/org/apache/commons/lang3/text/StrTokenizer.java
@@ -17,6 +17,7 @@
 package org.apache.commons.lang3.text;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
@@ -445,9 +446,7 @@ public class StrTokenizer implements ListIterator<String>, Cloneable
{
     public List<String> getTokenList() {
         checkTokenized();
         final List<String> list = new ArrayList<>(tokens.length);
-        for (final String element : tokens) {
-            list.add(element);
-        }
+        list.addAll(Arrays.asList(tokens));
         return list;
     }
 

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
index b859932..7d26f8c 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDateFormat.java
@@ -632,7 +632,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter
{
      */
     @Override
     public boolean equals(final Object obj) {
-        if (obj instanceof FastDateFormat == false) {
+        if (!(obj instanceof FastDateFormat)) {
             return false;
         }
         final FastDateFormat other = (FastDateFormat) obj;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
index b603fac..6a392d2 100644
--- a/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
+++ b/src/main/java/org/apache/commons/lang3/time/FastDatePrinter.java
@@ -627,7 +627,7 @@ public class FastDatePrinter implements DatePrinter, Serializable {
      */
     @Override
     public boolean equals(final Object obj) {
-        if (obj instanceof FastDatePrinter == false) {
+        if (!(obj instanceof FastDatePrinter)) {
             return false;
         }
         final FastDatePrinter other = (FastDatePrinter) obj;

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/1571050a/src/main/java/org/apache/commons/lang3/tuple/Pair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/tuple/Pair.java b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
index 3414d04..dcf0922 100644
--- a/src/main/java/org/apache/commons/lang3/tuple/Pair.java
+++ b/src/main/java/org/apache/commons/lang3/tuple/Pair.java
@@ -157,7 +157,7 @@ public abstract class Pair<L, R> implements Map.Entry<L, R>,
Comparable<Pair<L,
      */
     @Override
     public String toString() {
-        return new StringBuilder().append('(').append(getLeft()).append(',').append(getRight()).append(')').toString();
+        return "(" + getLeft() + ',' + getRight() + ')';
     }
 
     /**


Mime
View raw message