Use Javadoc @code
This commit is contained in:
parent
3334009c30
commit
c1955a2086
|
@ -8704,10 +8704,10 @@ public class ArrayUtils {
|
|||
* Therefore new arrays of generic types can be created with this method.
|
||||
* For example, an array of Strings can be created:
|
||||
* </p>
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* String[] array = ArrayUtils.toArray("1", "2");
|
||||
* String[] emptyArray = ArrayUtils.<String>toArray();
|
||||
* </pre>
|
||||
* String[] emptyArray = ArrayUtils.<String>toArray();
|
||||
* }</pre>
|
||||
* <p>
|
||||
* The method is typically used in scenarios, where the caller itself uses generic types
|
||||
* that have to be combined into an array.
|
||||
|
@ -8716,7 +8716,7 @@ public class ArrayUtils {
|
|||
* Note, this method makes only sense to provide arguments of the same type so that the
|
||||
* compiler can deduce the type of the array itself. While it is possible to select the
|
||||
* type explicitly like in
|
||||
* {@code Number[] array = ArrayUtils.<Number>toArray(Integer.valueOf(42), Double.valueOf(Math.PI))},
|
||||
* {@code Number[] array = ArrayUtils.<Number>toArray(Integer.valueOf(42), Double.valueOf(Math.PI))},
|
||||
* there is no real advantage when compared to
|
||||
* {@code new Number[] {Integer.valueOf(42), Double.valueOf(Math.PI)}}.
|
||||
* </p>
|
||||
|
|
|
@ -316,18 +316,18 @@ public class Range<T> implements Serializable {
|
|||
* Fits the given element into this range by returning the given element or, if out of bounds, the range minimum if
|
||||
* below, or the range maximum if above.
|
||||
*
|
||||
* <pre>
|
||||
* Range<Integer> range = Range.between(16, 64);
|
||||
* range.fit(-9) --> 16
|
||||
* range.fit(0) --> 16
|
||||
* range.fit(15) --> 16
|
||||
* range.fit(16) --> 16
|
||||
* range.fit(17) --> 17
|
||||
* <pre>{@code
|
||||
* Range<Integer> range = Range.between(16, 64);
|
||||
* range.fit(-9) --> 16
|
||||
* range.fit(0) --> 16
|
||||
* range.fit(15) --> 16
|
||||
* range.fit(16) --> 16
|
||||
* range.fit(17) --> 17
|
||||
* ...
|
||||
* range.fit(63) --> 63
|
||||
* range.fit(64) --> 64
|
||||
* range.fit(99) --> 64
|
||||
* </pre>
|
||||
* range.fit(63) --> 63
|
||||
* range.fit(64) --> 64
|
||||
* range.fit(99) --> 64
|
||||
* }</pre>
|
||||
* @param element the element to check for, not null
|
||||
* @return the minimum, the element, or the maximum depending on the element's location relative to the range
|
||||
* @throws NullPointerException if {@code element} is {@code null}
|
||||
|
|
|
@ -60,18 +60,18 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeAll(null, *) = null
|
||||
* StringUtils.removeAll("any", (Pattern) null) = "any"
|
||||
* StringUtils.removeAll("any", Pattern.compile("")) = "any"
|
||||
* StringUtils.removeAll("any", Pattern.compile(".*")) = ""
|
||||
* StringUtils.removeAll("any", Pattern.compile(".+")) = ""
|
||||
* StringUtils.removeAll("abc", Pattern.compile(".?")) = ""
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
|
||||
* StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -102,17 +102,17 @@ public class RegExUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeAll(null, *) = null
|
||||
* StringUtils.removeAll("any", (String) null) = "any"
|
||||
* StringUtils.removeAll("any", "") = "any"
|
||||
* StringUtils.removeAll("any", ".*") = ""
|
||||
* StringUtils.removeAll("any", ".+") = ""
|
||||
* StringUtils.removeAll("abc", ".?") = ""
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -142,18 +142,18 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeFirst(null, *) = null
|
||||
* StringUtils.removeFirst("any", (Pattern) null) = "any"
|
||||
* StringUtils.removeFirst("any", Pattern.compile("")) = "any"
|
||||
* StringUtils.removeFirst("any", Pattern.compile(".*")) = ""
|
||||
* StringUtils.removeFirst("any", Pattern.compile(".+")) = ""
|
||||
* StringUtils.removeFirst("abc", Pattern.compile(".?")) = "bc"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
|
||||
* StringUtils.removeFirst("ABCabc123", Pattern.compile("[a-z]")) = "ABCbc123"
|
||||
* StringUtils.removeFirst("ABCabc123abc", Pattern.compile("[a-z]+")) = "ABC123abc"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression pattern to which this string is to be matched
|
||||
|
@ -183,18 +183,18 @@ public class RegExUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeFirst(null, *) = null
|
||||
* StringUtils.removeFirst("any", (String) null) = "any"
|
||||
* StringUtils.removeFirst("any", "") = "any"
|
||||
* StringUtils.removeFirst("any", ".*") = ""
|
||||
* StringUtils.removeFirst("any", ".+") = ""
|
||||
* StringUtils.removeFirst("abc", ".?") = "bc"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123"
|
||||
* StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -224,12 +224,12 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removePattern(null, *) = null
|
||||
* StringUtils.removePattern("any", (String) null) = "any"
|
||||
* StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
|
||||
* StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
|
||||
* StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text
|
||||
* the source string
|
||||
|
@ -254,7 +254,7 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceAll(null, *, *) = null
|
||||
* StringUtils.replaceAll("any", (Pattern) null, *) = "any"
|
||||
* StringUtils.replaceAll("any", *, null) = "any"
|
||||
|
@ -262,14 +262,14 @@ public class RegExUtils {
|
|||
* StringUtils.replaceAll("", Pattern.compile(".*"), "zzz") = "zzz"
|
||||
* StringUtils.replaceAll("", Pattern.compile(".+"), "zzz") = ""
|
||||
* StringUtils.replaceAll("abc", Pattern.compile(""), "ZZ") = "ZZaZZbZZcZZ"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>", Pattern.DOTALL), "z") = "z"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>", Pattern.DOTALL), "z") = "z"
|
||||
* StringUtils.replaceAll("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
|
||||
* StringUtils.replaceAll("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC___123"
|
||||
* StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123"
|
||||
* StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123"
|
||||
* StringUtils.replaceAll("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum_dolor_sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression pattern to which this string is to be matched
|
||||
|
@ -304,7 +304,7 @@ public class RegExUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceAll(null, *, *) = null
|
||||
* StringUtils.replaceAll("any", (String) null, *) = "any"
|
||||
* StringUtils.replaceAll("any", *, null) = "any"
|
||||
|
@ -312,13 +312,13 @@ public class RegExUtils {
|
|||
* StringUtils.replaceAll("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replaceAll("", ".+", "zzz") = ""
|
||||
* StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123"
|
||||
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
|
||||
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
|
||||
* StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -352,7 +352,7 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceFirst(null, *, *) = null
|
||||
* StringUtils.replaceFirst("any", (Pattern) null, *) = "any"
|
||||
* StringUtils.replaceFirst("any", *, null) = "any"
|
||||
|
@ -360,13 +360,13 @@ public class RegExUtils {
|
|||
* StringUtils.replaceFirst("", Pattern.compile(".*"), "zzz") = "zzz"
|
||||
* StringUtils.replaceFirst("", Pattern.compile(".+"), "zzz") = ""
|
||||
* StringUtils.replaceFirst("abc", Pattern.compile(""), "ZZ") = "ZZabc"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
|
||||
* StringUtils.replaceFirst("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC_bc123"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123abc"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123abc"
|
||||
* StringUtils.replaceFirst("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum dolor sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression pattern to which this string is to be matched
|
||||
|
@ -400,7 +400,7 @@ public class RegExUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceFirst(null, *, *) = null
|
||||
* StringUtils.replaceFirst("any", (String) null, *) = "any"
|
||||
* StringUtils.replaceFirst("any", *, null) = "any"
|
||||
|
@ -408,13 +408,13 @@ public class RegExUtils {
|
|||
* StringUtils.replaceFirst("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replaceFirst("", ".+", "zzz") = ""
|
||||
* StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc"
|
||||
* StringUtils.replaceFirst("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum dolor sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -448,19 +448,19 @@ public class RegExUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replacePattern(null, *, *) = null
|
||||
* StringUtils.replacePattern("any", (String) null, *) = "any"
|
||||
* StringUtils.replacePattern("any", *, null) = "any"
|
||||
* StringUtils.replacePattern("", "", "zzz") = "zzz"
|
||||
* StringUtils.replacePattern("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replacePattern("", ".+", "zzz") = ""
|
||||
* StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
|
||||
* StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
|
||||
* StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123"
|
||||
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
|
||||
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
|
||||
* StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text
|
||||
* the source string
|
||||
|
|
|
@ -41,8 +41,8 @@ import org.apache.commons.lang3.Functions.FailablePredicate;
|
|||
* specifically, it attempts to address the fact that lambdas are supposed
|
||||
* not to throw Exceptions, at least not checked Exceptions, AKA instances
|
||||
* of {@link Exception}. This enforces the use of constructs like
|
||||
* <pre>
|
||||
* Consumer<java.lang.reflect.Method> consumer = m -> {
|
||||
* <pre>{@code
|
||||
* Consumer<java.lang.reflect.Method> consumer = m -> {
|
||||
* try {
|
||||
* m.invoke(o, args);
|
||||
* } catch (Throwable t) {
|
||||
|
@ -50,10 +50,10 @@ import org.apache.commons.lang3.Functions.FailablePredicate;
|
|||
* }
|
||||
* };
|
||||
* stream.forEach(consumer);
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* Using a {@link FailableStream}, this can be rewritten as follows:
|
||||
* <pre>
|
||||
* Streams.failable(stream).forEach((m) -> m.invoke(o, args));
|
||||
* Streams.failable(stream).forEach((m) -> m.invoke(o, args));
|
||||
* </pre>
|
||||
* Obviously, the second version is much more concise and the spirit of
|
||||
* Lambda expressions is met better than in the first version.
|
||||
|
@ -460,26 +460,26 @@ public class Streams {
|
|||
* {@link FailableConsumer} may be applied, instead of
|
||||
* {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is
|
||||
* to rewrite a code snippet like this:
|
||||
* <pre>
|
||||
* final List<O> list;
|
||||
* <pre>{@code
|
||||
* final List<O> list;
|
||||
* final Method m;
|
||||
* final Function<O,String> mapper = (o) -> {
|
||||
* final Function<O,String> mapper = (o) -> {
|
||||
* try {
|
||||
* return (String) m.invoke(o);
|
||||
* } catch (Throwable t) {
|
||||
* throw Functions.rethrow(t);
|
||||
* }
|
||||
* };
|
||||
* final List<String> strList = list.stream()
|
||||
* final List<String> strList = list.stream()
|
||||
* .map(mapper).collect(Collectors.toList());
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* as follows:
|
||||
* <pre>
|
||||
* final List<O> list;
|
||||
* <pre>{@code
|
||||
* final List<O> list;
|
||||
* final Method m;
|
||||
* final List<String> strList = Functions.stream(list.stream())
|
||||
* .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
|
||||
* </pre>
|
||||
* final List<String> strList = Functions.stream(list.stream())
|
||||
* .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
|
||||
* }</pre>
|
||||
* While the second version may not be <em>quite</em> as
|
||||
* efficient (because it depends on the creation of additional,
|
||||
* intermediate objects, of type FailableStream), it is much more
|
||||
|
@ -502,26 +502,26 @@ public class Streams {
|
|||
* {@link FailableConsumer} may be applied, instead of
|
||||
* {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is
|
||||
* to rewrite a code snippet like this:
|
||||
* <pre>
|
||||
* final List<O> list;
|
||||
* <pre>{@code
|
||||
* final List<O> list;
|
||||
* final Method m;
|
||||
* final Function<O,String> mapper = (o) -> {
|
||||
* final Function<O,String> mapper = (o) -> {
|
||||
* try {
|
||||
* return (String) m.invoke(o);
|
||||
* } catch (Throwable t) {
|
||||
* throw Functions.rethrow(t);
|
||||
* }
|
||||
* };
|
||||
* final List<String> strList = list.stream()
|
||||
* final List<String> strList = list.stream()
|
||||
* .map(mapper).collect(Collectors.toList());
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* as follows:
|
||||
* <pre>
|
||||
* final List<O> list;
|
||||
* <pre>{@code
|
||||
* final List<O> list;
|
||||
* final Method m;
|
||||
* final List<String> strList = Functions.stream(list.stream())
|
||||
* .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
|
||||
* </pre>
|
||||
* final List<String> strList = Functions.stream(list.stream())
|
||||
* .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
|
||||
* }</pre>
|
||||
* While the second version may not be <em>quite</em> as
|
||||
* efficient (because it depends on the creation of additional,
|
||||
* intermediate objects, of type FailableStream), it is much more
|
||||
|
|
|
@ -801,16 +801,16 @@ public class StringUtils {
|
|||
* <p>{@code null} value is considered less than non-{@code null} value.
|
||||
* Two {@code null} references are considered equal.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.compare(null, null) = 0
|
||||
* StringUtils.compare(null , "a") < 0
|
||||
* StringUtils.compare("a", null) > 0
|
||||
* StringUtils.compare(null , "a") < 0
|
||||
* StringUtils.compare("a", null) > 0
|
||||
* StringUtils.compare("abc", "abc") = 0
|
||||
* StringUtils.compare("a", "b") < 0
|
||||
* StringUtils.compare("b", "a") > 0
|
||||
* StringUtils.compare("a", "B") > 0
|
||||
* StringUtils.compare("ab", "abc") < 0
|
||||
* </pre>
|
||||
* StringUtils.compare("a", "b") < 0
|
||||
* StringUtils.compare("b", "a") > 0
|
||||
* StringUtils.compare("a", "B") > 0
|
||||
* StringUtils.compare("ab", "abc") < 0
|
||||
* }</pre>
|
||||
*
|
||||
* @see #compare(String, String, boolean)
|
||||
* @see String#compareTo(String)
|
||||
|
@ -837,18 +837,18 @@ public class StringUtils {
|
|||
* <p>{@code null} inputs are handled according to the {@code nullIsLess} parameter.
|
||||
* Two {@code null} references are considered equal.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.compare(null, null, *) = 0
|
||||
* StringUtils.compare(null , "a", true) < 0
|
||||
* StringUtils.compare(null , "a", false) > 0
|
||||
* StringUtils.compare("a", null, true) > 0
|
||||
* StringUtils.compare("a", null, false) < 0
|
||||
* StringUtils.compare(null , "a", true) < 0
|
||||
* StringUtils.compare(null , "a", false) > 0
|
||||
* StringUtils.compare("a", null, true) > 0
|
||||
* StringUtils.compare("a", null, false) < 0
|
||||
* StringUtils.compare("abc", "abc", *) = 0
|
||||
* StringUtils.compare("a", "b", *) < 0
|
||||
* StringUtils.compare("b", "a", *) > 0
|
||||
* StringUtils.compare("a", "B", *) > 0
|
||||
* StringUtils.compare("ab", "abc", *) < 0
|
||||
* </pre>
|
||||
* StringUtils.compare("a", "b", *) < 0
|
||||
* StringUtils.compare("b", "a", *) > 0
|
||||
* StringUtils.compare("a", "B", *) > 0
|
||||
* StringUtils.compare("ab", "abc", *) < 0
|
||||
* }</pre>
|
||||
*
|
||||
* @see String#compareTo(String)
|
||||
* @param str1 the String to compare from
|
||||
|
@ -886,18 +886,18 @@ public class StringUtils {
|
|||
* Two {@code null} references are considered equal.
|
||||
* Comparison is case insensitive.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.compareIgnoreCase(null, null) = 0
|
||||
* StringUtils.compareIgnoreCase(null , "a") < 0
|
||||
* StringUtils.compareIgnoreCase("a", null) > 0
|
||||
* StringUtils.compareIgnoreCase(null , "a") < 0
|
||||
* StringUtils.compareIgnoreCase("a", null) > 0
|
||||
* StringUtils.compareIgnoreCase("abc", "abc") = 0
|
||||
* StringUtils.compareIgnoreCase("abc", "ABC") = 0
|
||||
* StringUtils.compareIgnoreCase("a", "b") < 0
|
||||
* StringUtils.compareIgnoreCase("b", "a") > 0
|
||||
* StringUtils.compareIgnoreCase("a", "B") < 0
|
||||
* StringUtils.compareIgnoreCase("A", "b") < 0
|
||||
* StringUtils.compareIgnoreCase("ab", "ABC") < 0
|
||||
* </pre>
|
||||
* StringUtils.compareIgnoreCase("a", "b") < 0
|
||||
* StringUtils.compareIgnoreCase("b", "a") > 0
|
||||
* StringUtils.compareIgnoreCase("a", "B") < 0
|
||||
* StringUtils.compareIgnoreCase("A", "b") < 0
|
||||
* StringUtils.compareIgnoreCase("ab", "ABC") < 0
|
||||
* }</pre>
|
||||
*
|
||||
* @see #compareIgnoreCase(String, String, boolean)
|
||||
* @see String#compareToIgnoreCase(String)
|
||||
|
@ -927,20 +927,20 @@ public class StringUtils {
|
|||
* Two {@code null} references are considered equal.
|
||||
* Comparison is case insensitive.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.compareIgnoreCase(null, null, *) = 0
|
||||
* StringUtils.compareIgnoreCase(null , "a", true) < 0
|
||||
* StringUtils.compareIgnoreCase(null , "a", false) > 0
|
||||
* StringUtils.compareIgnoreCase("a", null, true) > 0
|
||||
* StringUtils.compareIgnoreCase("a", null, false) < 0
|
||||
* StringUtils.compareIgnoreCase(null , "a", true) < 0
|
||||
* StringUtils.compareIgnoreCase(null , "a", false) > 0
|
||||
* StringUtils.compareIgnoreCase("a", null, true) > 0
|
||||
* StringUtils.compareIgnoreCase("a", null, false) < 0
|
||||
* StringUtils.compareIgnoreCase("abc", "abc", *) = 0
|
||||
* StringUtils.compareIgnoreCase("abc", "ABC", *) = 0
|
||||
* StringUtils.compareIgnoreCase("a", "b", *) < 0
|
||||
* StringUtils.compareIgnoreCase("b", "a", *) > 0
|
||||
* StringUtils.compareIgnoreCase("a", "B", *) < 0
|
||||
* StringUtils.compareIgnoreCase("A", "b", *) < 0
|
||||
* StringUtils.compareIgnoreCase("ab", "abc", *) < 0
|
||||
* </pre>
|
||||
* StringUtils.compareIgnoreCase("a", "b", *) < 0
|
||||
* StringUtils.compareIgnoreCase("b", "a", *) > 0
|
||||
* StringUtils.compareIgnoreCase("a", "B", *) < 0
|
||||
* StringUtils.compareIgnoreCase("A", "b", *) < 0
|
||||
* StringUtils.compareIgnoreCase("ab", "abc", *) < 0
|
||||
* }</pre>
|
||||
*
|
||||
* @see String#compareToIgnoreCase(String)
|
||||
* @param str1 the String to compare from
|
||||
|
@ -5889,17 +5889,17 @@ public class StringUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeAll(null, *) = null
|
||||
* StringUtils.removeAll("any", (String) null) = "any"
|
||||
* StringUtils.removeAll("any", "") = "any"
|
||||
* StringUtils.removeAll("any", ".*") = ""
|
||||
* StringUtils.removeAll("any", ".+") = ""
|
||||
* StringUtils.removeAll("abc", ".?") = ""
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
|
||||
* StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -6008,18 +6008,18 @@ public class StringUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removeFirst(null, *) = null
|
||||
* StringUtils.removeFirst("any", (String) null) = "any"
|
||||
* StringUtils.removeFirst("any", "") = "any"
|
||||
* StringUtils.removeFirst("any", ".*") = ""
|
||||
* StringUtils.removeFirst("any", ".+") = ""
|
||||
* StringUtils.removeFirst("abc", ".?") = "bc"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
|
||||
* StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
|
||||
* StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123"
|
||||
* StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to remove from, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -6088,12 +6088,12 @@ public class StringUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.removePattern(null, *) = null
|
||||
* StringUtils.removePattern("any", (String) null) = "any"
|
||||
* StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
|
||||
* StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
|
||||
* StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param source
|
||||
* the source string
|
||||
|
@ -6458,7 +6458,7 @@ public class StringUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceAll(null, *, *) = null
|
||||
* StringUtils.replaceAll("any", (String) null, *) = "any"
|
||||
* StringUtils.replaceAll("any", *, null) = "any"
|
||||
|
@ -6466,13 +6466,13 @@ public class StringUtils {
|
|||
* StringUtils.replaceAll("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replaceAll("", ".+", "zzz") = ""
|
||||
* StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
|
||||
* StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123"
|
||||
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
|
||||
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
|
||||
* StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -6862,7 +6862,7 @@ public class StringUtils {
|
|||
* To use the DOTALL option prepend {@code "(?s)"} to the regex.
|
||||
* DOTALL is also known as single-line mode in Perl.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replaceFirst(null, *, *) = null
|
||||
* StringUtils.replaceFirst("any", (String) null, *) = "any"
|
||||
* StringUtils.replaceFirst("any", *, null) = "any"
|
||||
|
@ -6870,13 +6870,13 @@ public class StringUtils {
|
|||
* StringUtils.replaceFirst("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replaceFirst("", ".+", "zzz") = ""
|
||||
* StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
|
||||
* StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
|
||||
* StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc"
|
||||
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc"
|
||||
* StringUtils.replaceFirst("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum dolor sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param text text to search and replace in, may be null
|
||||
* @param regex the regular expression to which this string is to be matched
|
||||
|
@ -7028,19 +7028,19 @@ public class StringUtils {
|
|||
*
|
||||
* <p>A {@code null} reference passed to this method is a no-op.</p>
|
||||
*
|
||||
* <pre>
|
||||
* <pre>{@code
|
||||
* StringUtils.replacePattern(null, *, *) = null
|
||||
* StringUtils.replacePattern("any", (String) null, *) = "any"
|
||||
* StringUtils.replacePattern("any", *, null) = "any"
|
||||
* StringUtils.replacePattern("", "", "zzz") = "zzz"
|
||||
* StringUtils.replacePattern("", ".*", "zzz") = "zzz"
|
||||
* StringUtils.replacePattern("", ".+", "zzz") = ""
|
||||
* StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
|
||||
* StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
|
||||
* StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123"
|
||||
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
|
||||
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
|
||||
* StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
|
||||
* </pre>
|
||||
* }</pre>
|
||||
*
|
||||
* @param source
|
||||
* the source string
|
||||
|
|
|
@ -556,8 +556,8 @@ public class Validate {
|
|||
* validating according to an arbitrary boolean expression, such as validating a
|
||||
* primitive number or using your own custom validation expression.
|
||||
*
|
||||
* <pre>
|
||||
* Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);</pre>
|
||||
* <pre>{@code
|
||||
* Validate.isTrue(i >= min && i <= max, "The value must be between %d and %d", min, max);}</pre>
|
||||
*
|
||||
* @param expression the boolean expression to check
|
||||
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null
|
||||
|
|
|
@ -1248,11 +1248,12 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
|
|||
* This method is useful for adding a separator each time around the
|
||||
* loop except the first.
|
||||
* </p>
|
||||
* <pre>
|
||||
* for (int i = 0; i < list.size(); i++) {
|
||||
* <pre>{@code
|
||||
* for (int i = 0; i < list.size(); i++) {
|
||||
* appendSeparator(",", i);
|
||||
* append(list.get(i));
|
||||
* }
|
||||
* }
|
||||
* </pre>
|
||||
* Note that for this simple example, you should use
|
||||
* {@link #appendWithSeparators(Iterable, String)}.
|
||||
|
@ -1304,12 +1305,12 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
|
|||
* This method is useful for adding a separator each time around the
|
||||
* loop except the first.
|
||||
* </p>
|
||||
* <pre>
|
||||
* for (int i = 0; i < list.size(); i++) {
|
||||
* <pre>{@code
|
||||
* for (int i = 0; i < list.size(); i++) {
|
||||
* appendSeparator(",", i);
|
||||
* append(list.get(i));
|
||||
* }
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* Note that for this simple example, you should use
|
||||
* {@link #appendWithSeparators(Iterable, String)}.
|
||||
*
|
||||
|
|
|
@ -172,11 +172,11 @@ public abstract class StrLookup<V> {
|
|||
* The {@link #lookup(String)} method always returns a String, regardless of
|
||||
* the underlying data, by converting it as necessary. For example:
|
||||
* </p>
|
||||
* <pre>
|
||||
* Map<String, Object> map = new HashMap<String, Object>();
|
||||
* <pre>{@code
|
||||
* Map<String, Object> map = new HashMap<String, Object>();
|
||||
* map.put("number", Integer.valueOf(2));
|
||||
* assertEquals("2", StrLookup.mapLookup(map).lookup("number"));
|
||||
* </pre>
|
||||
* }</pre>
|
||||
* @param key the key to be looked up, may be null
|
||||
* @return the matching value, null if no match
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue