Skip to content

Commit 4161d60

Browse files
committed
Internal refactoring
1 parent 2595926 commit 4161d60

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/main/java/org/apache/commons/lang3/CharSetUtils.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class CharSetUtils {
5151
* @since 3.2
5252
*/
5353
public static boolean containsAny(final String str, final String... set) {
54-
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
54+
if (isEmpty(str, set)) {
5555
return false;
5656
}
5757
final CharSet chars = CharSet.getInstance(set);
@@ -82,7 +82,7 @@ public static boolean containsAny(final String str, final String... set) {
8282
* @return the character count, zero if null string input
8383
*/
8484
public static int count(final String str, final String... set) {
85-
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
85+
if (isEmpty(str, set)) {
8686
return 0;
8787
}
8888
final CharSet chars = CharSet.getInstance(set);
@@ -125,12 +125,16 @@ private static boolean deepEmpty(final String[] strings) {
125125
* @return the modified String, {@code null} if null string input
126126
*/
127127
public static String delete(final String str, final String... set) {
128-
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
128+
if (isEmpty(str, set)) {
129129
return str;
130130
}
131131
return modify(str, set, false);
132132
}
133133

134+
private static boolean isEmpty(final String str, final String... set) {
135+
return StringUtils.isEmpty(str) || deepEmpty(set);
136+
}
137+
134138
/**
135139
* Takes an argument in set-syntax, see evaluateSet,
136140
* and keeps any of characters present in the specified string.
@@ -199,7 +203,7 @@ private static String modify(final String str, final String[] set, final boolean
199203
* @return the modified String, {@code null} if null string input
200204
*/
201205
public static String squeeze(final String str, final String... set) {
202-
if (StringUtils.isEmpty(str) || deepEmpty(set)) {
206+
if (isEmpty(str, set)) {
203207
return str;
204208
}
205209
final CharSet chars = CharSet.getInstance(set);

0 commit comments

Comments
 (0)