Merge conditions using the same blocks.
This commit is contained in:
parent
36111ba582
commit
9214c65371
|
@ -8879,9 +8879,7 @@ public class StringUtils {
|
||||||
for (int i = 0; i < strLen; ) {
|
for (int i = 0; i < strLen; ) {
|
||||||
final int oldCodepoint = str.codePointAt(i);
|
final int oldCodepoint = str.codePointAt(i);
|
||||||
final int newCodePoint;
|
final int newCodePoint;
|
||||||
if (Character.isUpperCase(oldCodepoint)) {
|
if (Character.isUpperCase(oldCodepoint) || Character.isTitleCase(oldCodepoint)) {
|
||||||
newCodePoint = Character.toLowerCase(oldCodepoint);
|
|
||||||
} else if (Character.isTitleCase(oldCodepoint)) {
|
|
||||||
newCodePoint = Character.toLowerCase(oldCodepoint);
|
newCodePoint = Character.toLowerCase(oldCodepoint);
|
||||||
} else if (Character.isLowerCase(oldCodepoint)) {
|
} else if (Character.isLowerCase(oldCodepoint)) {
|
||||||
newCodePoint = Character.toUpperCase(oldCodepoint);
|
newCodePoint = Character.toUpperCase(oldCodepoint);
|
||||||
|
|
|
@ -195,9 +195,7 @@ public class EventListenerSupport<L> implements Serializable {
|
||||||
*/
|
*/
|
||||||
public void addListener(final L listener, final boolean allowDuplicate) {
|
public void addListener(final L listener, final boolean allowDuplicate) {
|
||||||
Validate.notNull(listener, "Listener object cannot be null.");
|
Validate.notNull(listener, "Listener object cannot be null.");
|
||||||
if (allowDuplicate) {
|
if (allowDuplicate || !listeners.contains(listener)) {
|
||||||
listeners.add(listener);
|
|
||||||
} else if (!listeners.contains(listener)) {
|
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -757,10 +757,8 @@ public class MethodUtils {
|
||||||
return method;
|
return method;
|
||||||
} else if (methodName.equals(method.getName()) &&
|
} else if (methodName.equals(method.getName()) &&
|
||||||
ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) {
|
ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) {
|
||||||
if (inexactMatch == null) {
|
if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes())
|
||||||
inexactMatch = method;
|
< distance(parameterTypes, inexactMatch.getParameterTypes()))) {
|
||||||
} else if (distance(parameterTypes, method.getParameterTypes())
|
|
||||||
< distance(parameterTypes, inexactMatch.getParameterTypes())) {
|
|
||||||
inexactMatch = method;
|
inexactMatch = method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1007,14 +1005,10 @@ public class MethodUtils {
|
||||||
Class<?> acls;
|
Class<?> acls;
|
||||||
if (interfaceIndex >= allInterfaces.size()) {
|
if (interfaceIndex >= allInterfaces.size()) {
|
||||||
acls = allSuperclasses.get(superClassIndex++);
|
acls = allSuperclasses.get(superClassIndex++);
|
||||||
} else if (superClassIndex >= allSuperclasses.size()) {
|
} else if ((superClassIndex >= allSuperclasses.size()) || (interfaceIndex < superClassIndex) || !(superClassIndex < interfaceIndex)) {
|
||||||
acls = allInterfaces.get(interfaceIndex++);
|
acls = allInterfaces.get(interfaceIndex++);
|
||||||
} else if (interfaceIndex < superClassIndex) {
|
|
||||||
acls = allInterfaces.get(interfaceIndex++);
|
|
||||||
} else if (superClassIndex < interfaceIndex) {
|
|
||||||
acls = allSuperclasses.get(superClassIndex++);
|
|
||||||
} else {
|
} else {
|
||||||
acls = allInterfaces.get(interfaceIndex++);
|
acls = allSuperclasses.get(superClassIndex++);
|
||||||
}
|
}
|
||||||
allSuperClassesAndInterfaces.add(acls);
|
allSuperClassesAndInterfaces.add(acls);
|
||||||
}
|
}
|
||||||
|
|
|
@ -582,10 +582,7 @@ public class WordUtils {
|
||||||
|
|
||||||
for (int i = 0; i < buffer.length; i++) {
|
for (int i = 0; i < buffer.length; i++) {
|
||||||
final char ch = buffer[i];
|
final char ch = buffer[i];
|
||||||
if (Character.isUpperCase(ch)) {
|
if (Character.isUpperCase(ch) || Character.isTitleCase(ch)) {
|
||||||
buffer[i] = Character.toLowerCase(ch);
|
|
||||||
whitespace = false;
|
|
||||||
} else if (Character.isTitleCase(ch)) {
|
|
||||||
buffer[i] = Character.toLowerCase(ch);
|
buffer[i] = Character.toLowerCase(ch);
|
||||||
whitespace = false;
|
whitespace = false;
|
||||||
} else if (Character.isLowerCase(ch)) {
|
} else if (Character.isLowerCase(ch)) {
|
||||||
|
|
Loading…
Reference in New Issue