Top Constructors Methods
com.vladsch.flexmark.util.misc

public Class Utils

extends Object
Class Inheritance
Imports
org.jetbrains.annotations.NotNull, .Nullable, java.io.*, java.net.URLDecoder, .URLEncoder, java.util.*, java.util.function.BiFunction, .Function, .Supplier

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
public static <T extends Comparable<T>> int
compareNullable(T i1, T i2)

public static int
count(String receiver, char c, int startIndex, int endIndex)

public static int
count(String receiver, String c, int startIndex, int endIndex)

public static boolean
endsWith(String receiver, String... needles)

public static boolean
endsWith(String receiver, boolean ignoreCase, String... needles)

public static boolean
endsWith(CharSequence receiver, String suffix, boolean ignoreCase)

public static @NotNull String
public static void
public static String
getAbbreviatedText(String text, int maxLength)

public static String

Returns:

longest common prefix
getLongestCommonPrefix
(String...
array of strings or null
s
)

Longest Common Prefix for a set of strings

public static <T> T
getOrNull(@NotNull List<T> list, int index)

public static <T, S extends T> S
getOrNull(@NotNull List<T> list, int index, Class<S> elementClass)

public static String
getResourceAsString(Class<?> clazz, String resourcePath)

public static String
ifEmpty(String receiver, String arg)

public static String
ifEmpty(String receiver, String ifEmptyArg, String ifNotEmptyArg)

public static String
ifEmpty(String receiver, Supplier<String> arg)

public static String
ifEmpty(String receiver, Supplier<String> ifEmptyArg, Supplier<String> ifNotEmptyArg)

public static String
ifEmptyNullArgs(String receiver, String ifEmptyArg, String ifNotEmptyArg)

public static <T> T
ifNull(T receiver, T altValue)

public static <T> T
ifNullOr(T receiver, boolean condition, T altValue)

public static <T> T
ifNullOr(T receiver, Function<T, Boolean> condition, T altValue)

public static String
ifNullOrBlank(String receiver, String altValue)

public static String
ifNullOrEmpty(String receiver, String altValue)

public static <T> T
ifNullOrNot(T receiver, boolean condition, T altValue)

public static <T> T
ifNullOrNot(T receiver, Function<T, Boolean> condition, T altValue)

public static boolean
isBlank(String receiver)

public static boolean
isIn(String receiver, String... list)

public static boolean
public static String
join(String[] items, String prefix, String suffix, String itemPrefix, String itemSuffix)

public static String
join(Collection<String> items, String prefix, String suffix, String itemPrefix, String itemSuffix)

public static int
max(int receiver, int... others)

public static float
max(float receiver, float... others)

public static int
maxLimit(int receiver, int... maxBound)

public static float
maxLimit(float receiver, float... maxBound)

public static int
min(int receiver, int... others)

public static float
min(float receiver, float... others)

public static int
minLimit(int receiver, int... minBound)

public static float
minLimit(float receiver, float... minBound)

public static String
orEmpty(String receiver)

public static String
prefixWith(String receiver, char prefix)

public static String
prefixWith(String receiver, char prefix, boolean ignoreCase)

public static String
prefixWith(String receiver, String prefix)

public static String
prefixWith(String receiver, String prefix, boolean ignoreCase)

public static <K, V> V
putIfMissing(Map<K, V> receiver, K key, Supplier<V> value)

public static @NotNull String
public static int
rangeLimit(int receiver, int minBound, int maxBound)

public static float
rangeLimit(float receiver, float minBound, float maxBound)

public static String
regexGroup(String receiver)

public static boolean
regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)

public static String
removeAnyPrefix(String receiver, String... prefixes)

public static String
removeAnySuffix(String receiver, String... suffixes)

public static <K, V> void
removeIf(Map<K, V> receiver, Function<Map.Entry<K, V>, Boolean> removeFilter)

public static <K, V> void
removeIf(Map<K, V> receiver, BiFunction<K, V, Boolean> removeFilter)

public static String
removePrefix(String receiver, char prefix)

public static String
removePrefix(String receiver, String prefix)

public static String
removePrefixIncluding(String receiver, String delimiter)

public static String
removeSuffix(String receiver, char suffix)

public static String
removeSuffix(String receiver, String suffix)

public static String
repeat(String text, int repeatCount)

public static <T> T
setOrAdd(@NotNull List<T> list, int index, T value)

public static String
splice(String[] receiver, String delimiter)

public static String
splice(Collection<String> receiver, String delimiter, boolean skipNullOrEmpty)

public static boolean
startsWith(String receiver, String... needles)

public static boolean
startsWith(String receiver, boolean ignoreCase, String... needles)

public static boolean
startsWith(CharSequence receiver, String prefix, boolean ignoreCase)

public static void
public static <T> List<? extends T>
stringSorted(Collection<? extends T> receiver, Function<T, String> stringer)

public static String
suffixWith(String receiver, char suffix)

public static String
suffixWith(String receiver, char suffix, boolean ignoreCase)

public static String
suffixWith(String receiver, String suffix)

public static String
suffixWith(String receiver, String suffix, boolean ignoreCase)

public static String
public static String
urlDecode(String receiver, String charSet)

public static String
urlEncode(String receiver, String charSet)

public static <K, V> Map<K, V>
withDefaults(Map<K, V> receiver, Map<K, V> defaults)

public static String
wrapWith(String receiver, char prefixSuffix)

public static String
wrapWith(String receiver, char prefix, char suffix)

public static String
wrapWith(String receiver, String prefixSuffix)

public static String
wrapWith(String receiver, String prefix, String suffix)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Utilsback to summary
public Utils()

Method Detail

compareback to summary
public static int compare(@Nullable Number n1, @Nullable Number n2)
compareNullableback to summary
public static <T extends Comparable<T>> int compareNullable(T i1, T i2)
countback to summary
public static int count(String receiver, char c, int startIndex, int endIndex)
countback to summary
public static int count(String receiver, String c, int startIndex, int endIndex)
endsWithback to summary
public static boolean endsWith(String receiver, String... needles)
endsWithback to summary
public static boolean endsWith(String receiver, boolean ignoreCase, String... needles)
endsWithback to summary
public static boolean endsWith(CharSequence receiver, String suffix, boolean ignoreCase)
escapeJavaStringback to summary
public static @NotNull String escapeJavaString(@Nullable CharSequence param)
Annotations
@NotNull
escapeJavaStringback to summary
public static void escapeJavaString(@NotNull StringBuilder out, @NotNull CharSequence chars)
getAbbreviatedTextback to summary
public static String getAbbreviatedText(String text, int maxLength)
getLongestCommonPrefixback to summary
public static String getLongestCommonPrefix(String... s)

Longest Common Prefix for a set of strings

Parameters
s:String[]

array of strings or null

Returns:String

longest common prefix

getOrNullback to summary
public static <T> T getOrNull(@NotNull List<T> list, int index)
getOrNullback to summary
public static <T, S extends T> S getOrNull(@NotNull List<T> list, int index, Class<S> elementClass)
getResourceAsStringback to summary
public static String getResourceAsString(Class<?> clazz, String resourcePath)
ifEmptyback to summary
public static String ifEmpty(String receiver, String arg)
ifEmptyback to summary
public static String ifEmpty(String receiver, String ifEmptyArg, String ifNotEmptyArg)
ifEmptyback to summary
public static String ifEmpty(String receiver, Supplier<String> arg)
ifEmptyback to summary
public static String ifEmpty(String receiver, Supplier<String> ifEmptyArg, Supplier<String> ifNotEmptyArg)
ifEmptyNullArgsback to summary
public static String ifEmptyNullArgs(String receiver, String ifEmptyArg, String ifNotEmptyArg)
ifNullback to summary
public static <T> T ifNull(T receiver, T altValue)
ifNullOrback to summary
public static <T> T ifNullOr(T receiver, boolean condition, T altValue)
ifNullOrback to summary
public static <T> T ifNullOr(T receiver, Function<T, Boolean> condition, T altValue)
ifNullOrBlankback to summary
public static String ifNullOrBlank(String receiver, String altValue)
ifNullOrEmptyback to summary
public static String ifNullOrEmpty(String receiver, String altValue)
ifNullOrNotback to summary
public static <T> T ifNullOrNot(T receiver, boolean condition, T altValue)
ifNullOrNotback to summary
public static <T> T ifNullOrNot(T receiver, Function<T, Boolean> condition, T altValue)
isBlankback to summary
public static boolean isBlank(String receiver)
isInback to summary
public static boolean isIn(String receiver, String... list)
isWhiteSpaceNoEOLback to summary
public static boolean isWhiteSpaceNoEOL(String receiver)
joinback to summary
public static String join(String[] items, String prefix, String suffix, String itemPrefix, String itemSuffix)
joinback to summary
public static String join(Collection<String> items, String prefix, String suffix, String itemPrefix, String itemSuffix)
maxback to summary
public static int max(int receiver, int... others)
maxback to summary
public static float max(float receiver, float... others)
maxLimitback to summary
public static int maxLimit(int receiver, int... maxBound)
maxLimitback to summary
public static float maxLimit(float receiver, float... maxBound)
minback to summary
public static int min(int receiver, int... others)
minback to summary
public static float min(float receiver, float... others)
minLimitback to summary
public static int minLimit(int receiver, int... minBound)
minLimitback to summary
public static float minLimit(float receiver, float... minBound)
orEmptyback to summary
public static String orEmpty(String receiver)
prefixWithback to summary
public static String prefixWith(String receiver, char prefix)
prefixWithback to summary
public static String prefixWith(String receiver, char prefix, boolean ignoreCase)
prefixWithback to summary
public static String prefixWith(String receiver, String prefix)
prefixWithback to summary
public static String prefixWith(String receiver, String prefix, boolean ignoreCase)
putIfMissingback to summary
public static <K, V> V putIfMissing(Map<K, V> receiver, K key, Supplier<V> value)
quoteJavaStringback to summary
public static @NotNull String quoteJavaString(@Nullable CharSequence param)
Annotations
@NotNull
rangeLimitback to summary
public static int rangeLimit(int receiver, int minBound, int maxBound)
rangeLimitback to summary
public static float rangeLimit(float receiver, float minBound, float maxBound)
regexGroupback to summary
public static String regexGroup(String receiver)
regionMatchesback to summary
public static boolean regionMatches(CharSequence receiver, int thisOffset, String other, int otherOffset, int length, boolean ignoreCase)
removeAnyPrefixback to summary
public static String removeAnyPrefix(String receiver, String... prefixes)
removeAnySuffixback to summary
public static String removeAnySuffix(String receiver, String... suffixes)
removeIfback to summary
public static <K, V> void removeIf(Map<K, V> receiver, Function<Map.Entry<K, V>, Boolean> removeFilter)
removeIfback to summary
public static <K, V> void removeIf(Map<K, V> receiver, BiFunction<K, V, Boolean> removeFilter)
removePrefixback to summary
public static String removePrefix(String receiver, char prefix)
removePrefixback to summary
public static String removePrefix(String receiver, String prefix)
removePrefixIncludingback to summary
public static String removePrefixIncluding(String receiver, String delimiter)
removeSuffixback to summary
public static String removeSuffix(String receiver, char suffix)
removeSuffixback to summary
public static String removeSuffix(String receiver, String suffix)
repeatback to summary
public static String repeat(String text, int repeatCount)
setOrAddback to summary
public static <T> T setOrAdd(@NotNull List<T> list, int index, T value)
spliceback to summary
public static String splice(String[] receiver, String delimiter)
spliceback to summary
public static String splice(Collection<String> receiver, String delimiter, boolean skipNullOrEmpty)
startsWithback to summary
public static boolean startsWith(String receiver, String... needles)
startsWithback to summary
public static boolean startsWith(String receiver, boolean ignoreCase, String... needles)
startsWithback to summary
public static boolean startsWith(CharSequence receiver, String prefix, boolean ignoreCase)
streamAppendback to summary
public static void streamAppend(StringBuilder sb, InputStream inputStream)
stringSortedback to summary
public static <T> List<? extends T> stringSorted(Collection<? extends T> receiver, Function<T, String> stringer)
suffixWithback to summary
public static String suffixWith(String receiver, char suffix)
suffixWithback to summary
public static String suffixWith(String receiver, char suffix, boolean ignoreCase)
suffixWithback to summary
public static String suffixWith(String receiver, String suffix)
suffixWithback to summary
public static String suffixWith(String receiver, String suffix, boolean ignoreCase)
suffixWithEolback to summary
public static String suffixWithEol(String receiver)
urlDecodeback to summary
public static String urlDecode(String receiver, String charSet)
urlEncodeback to summary
public static String urlEncode(String receiver, String charSet)
withDefaultsback to summary
public static <K, V> Map<K, V> withDefaults(Map<K, V> receiver, Map<K, V> defaults)
wrapWithback to summary
public static String wrapWith(String receiver, char prefixSuffix)
wrapWithback to summary
public static String wrapWith(String receiver, char prefix, char suffix)
wrapWithback to summary
public static String wrapWith(String receiver, String prefixSuffix)
wrapWithback to summary
public static String wrapWith(String receiver, String prefix, String suffix)