You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by br...@apache.org on 2017/06/08 08:15:43 UTC
[09/48] [lang] Make code more readable with less nesting (move block
out of else clause).
Make code more readable with less nesting (move block out of else
clause).
Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/6a688cf3
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/6a688cf3
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/6a688cf3
Branch: refs/heads/release
Commit: 6a688cf36e23aded8c9796b786e92144cb4a5830
Parents: ef3015c
Author: Gary Gregory <gg...@apache.org>
Authored: Thu May 25 09:25:56 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Thu May 25 09:25:56 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/commons/lang3/CharSetUtils.java | 14 ++++++--------
.../org/apache/commons/lang3/math/NumberUtils.java | 3 +--
.../java/org/apache/commons/lang3/text/WordUtils.java | 3 +--
3 files changed, 8 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/CharSetUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/CharSetUtils.java b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
index 84c1d09..015eeb8 100644
--- a/src/main/java/org/apache/commons/lang3/CharSetUtils.java
+++ b/src/main/java/org/apache/commons/lang3/CharSetUtils.java
@@ -78,15 +78,13 @@ public class CharSetUtils {
if (ch == lastChar) {
if (inChars != null && ch == inChars) {
continue;
- } else {
- if (notInChars == null || ch != notInChars) {
- if (chars.contains(ch)) {
- inChars = ch;
- continue;
- } else {
- notInChars = ch;
- }
+ }
+ if (notInChars == null || ch != notInChars) {
+ if (chars.contains(ch)) {
+ inChars = ch;
+ continue;
}
+ notInChars = ch;
}
}
buffer.append(ch);
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
index f77bf10..0d512fe 100644
--- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
+++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java
@@ -1542,9 +1542,8 @@ public class NumberUtils {
return false;
}
return withDecimalsParsing(str, 1);
- } else {
- return withDecimalsParsing(str, 0);
}
+ return withDecimalsParsing(str, 0);
}
private static boolean withDecimalsParsing(final String str, final int beginIdx) {
http://git-wip-us.apache.org/repos/asf/commons-lang/blob/6a688cf3/src/main/java/org/apache/commons/lang3/text/WordUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/text/WordUtils.java b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
index 16ae683..66ce445 100644
--- a/src/main/java/org/apache/commons/lang3/text/WordUtils.java
+++ b/src/main/java/org/apache/commons/lang3/text/WordUtils.java
@@ -293,9 +293,8 @@ public class WordUtils {
if (matcher.start() == 0) {
offset += matcher.end();
continue;
- }else {
- spaceToWrapAt = matcher.start() + offset;
}
+ spaceToWrapAt = matcher.start() + offset;
}
// only last line without leading spaces is left