Skip to content

Commit 4d94035

Browse files
committed
Formatted code to move private methods down
1 parent 84b3303 commit 4d94035

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

src/main/java/strman/Strman.java

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,22 @@ public static Optional<String> trimEnd(final String input, String... chars) {
12901290
}
12911291

12921292

1293+
/**
1294+
* Counts the number of occurrences of each character in the string
1295+
*
1296+
* @param input The input string
1297+
* @return A map containing the number of occurrences of each character in the string
1298+
*/
1299+
public static Map<Character, Long> charsCount(String input) {
1300+
if (isNullOrEmpty(input)) {
1301+
return Collections.emptyMap();
1302+
}
1303+
1304+
return input.chars()
1305+
.mapToObj(c -> (char) c)
1306+
.collect(groupingBy(identity(), counting()));
1307+
}
1308+
12931309
private static void validate(String value, Predicate<String> predicate, final Supplier<String> supplier) {
12941310
if (predicate.test(value)) {
12951311
throw new IllegalArgumentException(supplier.get());
@@ -1309,20 +1325,5 @@ private static long countSubstr(String value, String subStr, boolean allowOverla
13091325
}
13101326
return countSubstr(value.substring(offset), subStr, allowOverlapping, ++count);
13111327
}
1312-
1313-
/**
1314-
* Counts the number of occurrences of each character in the string
1315-
*
1316-
* @param input The input string
1317-
* @return A map containing the number of occurrences of each character in the string
1318-
*/
1319-
public static Map<Character, Long> charsCount(String input) {
1320-
if (isNullOrEmpty(input)) {
1321-
return Collections.emptyMap();
1322-
}
1323-
1324-
return input.chars()
1325-
.mapToObj(c -> (char) c)
1326-
.collect(groupingBy(identity(), counting()));
1327-
}
13281328
}
1329+

0 commit comments

Comments
 (0)