Strings { public static String join(CharSequence delimiter, int[] values) { Objects.requireNonNull(delimiter); Objects.requireNonNull(values); if (values.length == 0) { return ""; } if (values.length == 1) { return Integer.toString(values[0]); } StringBuilder sb = new StringBuilder(); sb.append(values[0]); for (int i = 1; i != values.length; ++i) { sb.append(delimiter); sb.append(values[i]); } return sb.toString(); } private  Strings(); static Set<T> setOf(String input, Function<String, String[]> splitter, Function<String, T> factory); static List<T> listOf(String input, Function<String, String[]> splitter, Function<String, T> factory); static Set<T> setOf(String input, char delimiter, Function<String, T> factory); static Set<T> setOf(String input, Function<String, T> factory); static Set<Pattern> setOfRegex(String input, int regexFlags); static Set<Pattern> setOfRegex(String input); static List<Pattern> listOfRegex(String input, int regexFlags); static List<String> splitLines(final String content); static int compareTo(CharSequence str1, CharSequence str2); static boolean equalsIgnoreCase(String str1, String str2); static String join(CharSequence delimiter, int[] values); static String join(CharSequence delimiter, Iterable<T> values); static String join(CharSequence delimiter, Iterable<T> values, Function<T, String> conversion); static String trim(String str); static String trim(String str, CharacterPredicate predicate); static String createString(final char charToRepeat,
                                      int numberOfRepeats); static String pad(String original,
                             int length,
                             char padChar); static String setLength(String original,
                                   int length,
                                   char padChar); static String justify(Justify justify,
                                 String str,
                                 final int width,
                                 char padWithChar); static String justifyRight(String str,
                                      final int width,
                                      char padWithChar); static String justifyLeft(String str,
                                     final int width,
                                     char padWithChar); static String justifyCenter(String str,
                                       final int width,
                                       char padWithChar); static String getStackTrace(Throwable throwable); static Number asNumber(String value); static Number asNumber(String value, Supplier<Number> defaultValueProvider); static int asInt(String value, int defaultValue); static long asLong(String value, long defaultValue); static double asDouble(String value, double defaultValue); static boolean asBoolean(String value, boolean defaultValue); static Duration asDuration(String timeString); static String duration(long durationInMillis); static Function<String, String> replaceVariablesWith(Function<String, String> replacementsByVariableName); static String replaceVariables(String value, Function<String, String> replacementsByVariableName); static boolean isUuid(String str); static boolean isNullOrEmpty(String str); static boolean isNumeric(String str); static String unquoteIdentifierPart(String identifierPart); static byte[] hexStringToByteArray(String hexString); static boolean startsWithIgnoreCase(String str, String prefix); static String getBegin(String str, int length);  }
@Test public void joinShouldExcludeFirstNullableElement() { assertThat(Strings.join(",", Arrays.asList(null, "b", "c"))).isEqualTo("b,c"); }
@Test public void joinShouldExcludeSecondNullableElement() { assertThat(Strings.join(",", Arrays.asList("a", null, "c"))).isEqualTo("a,c"); }
@Test public void joinShouldExcludeAllNullableElements() { assertThat(Strings.join(",", Arrays.asList(null, null, null))).isEqualTo(""); }
@Test public void joinWithConversionShouldConvertAllElements() { assertThat(Strings.join(",", Arrays.asList("a", "b", "c"), s -> "_" + s)).isEqualTo("_a,_b,_c"); }