com.brambolt.util.Strings Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of brambolt-rt Show documentation
Show all versions of brambolt-rt Show documentation
Small utilities and convenience wrappers.
package com.brambolt.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@SuppressWarnings("unused")
public class Strings {
public static List asList(String value) {
return asList(value, ",");
}
public static List asList(String value, String delimiter) {
return (null != value && !value.trim().isEmpty())
? Arrays.asList(value.split(delimiter))
: new ArrayList<>(); // An empty list for an empty value
}
public static int maxLength(String[] strings) {
int length = 0;
for (String s: strings) {
int current = s.length();
if (current > length)
length = current;
}
return length;
}
}