From b462572e013e916f18004be1d596e63f365a7319 Mon Sep 17 00:00:00 2001 From: "Gary D. Gregory" Date: Wed, 5 Jun 2013 03:40:00 +0000 Subject: [PATCH] Statements unnecessarily nested within else clause. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1489695 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/commons/lang3/StringUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java index 2794161c0..d8c590134 100644 --- a/src/main/java/org/apache/commons/lang3/StringUtils.java +++ b/src/main/java/org/apache/commons/lang3/StringUtils.java @@ -5058,11 +5058,10 @@ public class StringUtils { public static String repeat(final String str, final String separator, final int repeat) { if(str == null || separator == null) { return repeat(str, repeat); - } else { - // given that repeat(String, int) is quite optimized, better to rely on it than try and splice this into it - final String result = repeat(str + separator, repeat); - return removeEnd(result, separator); } + // given that repeat(String, int) is quite optimized, better to rely on it than try and splice this into it + final String result = repeat(str + separator, repeat); + return removeEnd(result, separator); } /** @@ -6839,9 +6838,8 @@ public class StringUtils { // distance if (p[n] <= threshold) { return p[n]; - } else { - return -1; } + return -1; } // startsWith