public final class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
asList(T... ary)
转为一个可变 List
|
static Map |
asMap(Object... keyValues)
转为一个可变 Map
|
static <T> Set<T> |
asSet(T... ary)
转为一个可变 Set
|
static boolean |
hasText(String str)
Check whether the given
String contains actual text. |
static boolean |
isBlank(String str) |
static boolean |
isEmpty(Collection<?> collection)
Return
true if the supplied Collection is null or empty. |
static boolean |
isEmpty(Map<?,?> map)
Return
true if the supplied Map is null or empty. |
static URI |
resolveUri(URI baseUrl,
String endpointUrl)
Resolves the given endpoint URL against the base URL.
|
public static boolean hasText(@Nullable
String str)
String contains actual text.
More specifically, this method returns true if the String is not
null, its length is greater than 0, and it contains at least one
non-whitespace character.
str - the String to check (may be null)true if the String is not null, its length is
greater than 0, and it does not contain whitespace onlyCharacter.isWhitespace(char)public static boolean isBlank(String str)
public static boolean isEmpty(@Nullable
Collection<?> collection)
true if the supplied Collection is null or empty. Otherwise,
return false.collection - the Collection to checkpublic static boolean isEmpty(@Nullable
Map<?,?> map)
true if the supplied Map is null or empty. Otherwise, return
false.map - the Map to checkpublic static URI resolveUri(URI baseUrl, String endpointUrl)
IllegalArgumentException is
thrown.baseUrl - The base URL (must be absolute)endpointUrl - The endpoint URL (can be relative or absolute)IllegalArgumentException - If the absolute endpoint URL does not match the
base URL or URI is malformedpublic static <T> List<T> asList(T... ary)
public static <T> Set<T> asSet(T... ary)
Copyright © 2025. All rights reserved.