Use Javadoc @code

This commit is contained in:
Gary Gregory 2024-07-29 18:58:42 -04:00
parent 3334009c30
commit c1955a2086
8 changed files with 150 additions and 149 deletions

View File

@ -8704,10 +8704,10 @@ public class ArrayUtils {
* Therefore new arrays of generic types can be created with this method. * Therefore new arrays of generic types can be created with this method.
* For example, an array of Strings can be created: * For example, an array of Strings can be created:
* </p> * </p>
* <pre> * <pre>{@code
* String[] array = ArrayUtils.toArray("1", "2"); * String[] array = ArrayUtils.toArray("1", "2");
* String[] emptyArray = ArrayUtils.&lt;String&gt;toArray(); * String[] emptyArray = ArrayUtils.<String>toArray();
* </pre> * }</pre>
* <p> * <p>
* The method is typically used in scenarios, where the caller itself uses generic types * The method is typically used in scenarios, where the caller itself uses generic types
* that have to be combined into an array. * 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 * 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 * compiler can deduce the type of the array itself. While it is possible to select the
* type explicitly like in * type explicitly like in
* {@code Number[] array = ArrayUtils.&lt;Number&gt;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 * there is no real advantage when compared to
* {@code new Number[] {Integer.valueOf(42), Double.valueOf(Math.PI)}}. * {@code new Number[] {Integer.valueOf(42), Double.valueOf(Math.PI)}}.
* </p> * </p>

View File

@ -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 * 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. * below, or the range maximum if above.
* *
* <pre> * <pre>{@code
* Range&lt;Integer&gt; range = Range.between(16, 64); * Range<Integer> range = Range.between(16, 64);
* range.fit(-9) --&gt; 16 * range.fit(-9) --> 16
* range.fit(0) --&gt; 16 * range.fit(0) --> 16
* range.fit(15) --&gt; 16 * range.fit(15) --> 16
* range.fit(16) --&gt; 16 * range.fit(16) --> 16
* range.fit(17) --&gt; 17 * range.fit(17) --> 17
* ... * ...
* range.fit(63) --&gt; 63 * range.fit(63) --> 63
* range.fit(64) --&gt; 64 * range.fit(64) --> 64
* range.fit(99) --&gt; 64 * range.fit(99) --> 64
* </pre> * }</pre>
* @param element the element to check for, not null * @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 * @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} * @throws NullPointerException if {@code element} is {@code null}

View File

@ -60,18 +60,18 @@ public class RegExUtils {
* *
* <p>A {@code null} reference passed to this method is a no-op.</p> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeAll(null, *) = null * StringUtils.removeAll(null, *) = null
* StringUtils.removeAll("any", (Pattern) null) = "any" * StringUtils.removeAll("any", (Pattern) null) = "any"
* StringUtils.removeAll("any", Pattern.compile("")) = "any" * StringUtils.removeAll("any", Pattern.compile("")) = "any"
* StringUtils.removeAll("any", Pattern.compile(".*")) = "" * StringUtils.removeAll("any", Pattern.compile(".*")) = ""
* StringUtils.removeAll("any", Pattern.compile(".+")) = "" * StringUtils.removeAll("any", Pattern.compile(".+")) = ""
* StringUtils.removeAll("abc", Pattern.compile(".?")) = "" * StringUtils.removeAll("abc", Pattern.compile(".?")) = ""
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", Pattern.compile("&lt;.*&gt;")) = "A\nB" * StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\nB"
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", Pattern.compile("(?s)&lt;.*&gt;")) = "AB" * StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", Pattern.compile("&lt;.*&gt;", Pattern.DOTALL)) = "AB" * StringUtils.removeAll("A<__>\n<__>B", Pattern.compile("<.*>", Pattern.DOTALL)) = "AB"
* StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123" * StringUtils.removeAll("ABCabc123abc", Pattern.compile("[a-z]")) = "ABC123"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeAll(null, *) = null * StringUtils.removeAll(null, *) = null
* StringUtils.removeAll("any", (String) null) = "any" * StringUtils.removeAll("any", (String) null) = "any"
* StringUtils.removeAll("any", "") = "any" * StringUtils.removeAll("any", "") = "any"
* StringUtils.removeAll("any", ".*") = "" * StringUtils.removeAll("any", ".*") = ""
* StringUtils.removeAll("any", ".+") = "" * StringUtils.removeAll("any", ".+") = ""
* StringUtils.removeAll("abc", ".?") = "" * StringUtils.removeAll("abc", ".?") = ""
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "A\nB" * StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", "(?s)&lt;.*&gt;") = "AB" * StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
* StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123" * StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeFirst(null, *) = null * StringUtils.removeFirst(null, *) = null
* StringUtils.removeFirst("any", (Pattern) null) = "any" * StringUtils.removeFirst("any", (Pattern) null) = "any"
* StringUtils.removeFirst("any", Pattern.compile("")) = "any" * StringUtils.removeFirst("any", Pattern.compile("")) = "any"
* StringUtils.removeFirst("any", Pattern.compile(".*")) = "" * StringUtils.removeFirst("any", Pattern.compile(".*")) = ""
* StringUtils.removeFirst("any", Pattern.compile(".+")) = "" * StringUtils.removeFirst("any", Pattern.compile(".+")) = ""
* StringUtils.removeFirst("abc", Pattern.compile(".?")) = "bc" * StringUtils.removeFirst("abc", Pattern.compile(".?")) = "bc"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", Pattern.compile("&lt;.*&gt;")) = "A\n&lt;__&gt;B" * StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("<.*>")) = "A\n<__>B"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", Pattern.compile("(?s)&lt;.*&gt;")) = "AB" * StringUtils.removeFirst("A<__>\n<__>B", Pattern.compile("(?s)<.*>")) = "AB"
* StringUtils.removeFirst("ABCabc123", Pattern.compile("[a-z]")) = "ABCbc123" * StringUtils.removeFirst("ABCabc123", Pattern.compile("[a-z]")) = "ABCbc123"
* StringUtils.removeFirst("ABCabc123abc", Pattern.compile("[a-z]+")) = "ABC123abc" * StringUtils.removeFirst("ABCabc123abc", Pattern.compile("[a-z]+")) = "ABC123abc"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression pattern to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeFirst(null, *) = null * StringUtils.removeFirst(null, *) = null
* StringUtils.removeFirst("any", (String) null) = "any" * StringUtils.removeFirst("any", (String) null) = "any"
* StringUtils.removeFirst("any", "") = "any" * StringUtils.removeFirst("any", "") = "any"
* StringUtils.removeFirst("any", ".*") = "" * StringUtils.removeFirst("any", ".*") = ""
* StringUtils.removeFirst("any", ".+") = "" * StringUtils.removeFirst("any", ".+") = ""
* StringUtils.removeFirst("abc", ".?") = "bc" * StringUtils.removeFirst("abc", ".?") = "bc"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "A\n&lt;__&gt;B" * StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", "(?s)&lt;.*&gt;") = "AB" * StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
* StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123" * StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123"
* StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc" * StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removePattern(null, *) = null * StringUtils.removePattern(null, *) = null
* StringUtils.removePattern("any", (String) null) = "any" * StringUtils.removePattern("any", (String) null) = "any"
* StringUtils.removePattern("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "AB" * StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
* StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123" * StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123"
* </pre> * }</pre>
* *
* @param text * @param text
* the source string * the source string
@ -254,7 +254,7 @@ public class RegExUtils {
* *
* <p>A {@code null} reference passed to this method is a no-op.</p> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceAll(null, *, *) = null * StringUtils.replaceAll(null, *, *) = null
* StringUtils.replaceAll("any", (Pattern) null, *) = "any" * StringUtils.replaceAll("any", (Pattern) null, *) = "any"
* StringUtils.replaceAll("any", *, 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") = "zzz"
* StringUtils.replaceAll("", Pattern.compile(".+"), "zzz") = "" * StringUtils.replaceAll("", Pattern.compile(".+"), "zzz") = ""
* StringUtils.replaceAll("abc", Pattern.compile(""), "ZZ") = "ZZaZZbZZcZZ" * StringUtils.replaceAll("abc", Pattern.compile(""), "ZZ") = "ZZaZZbZZcZZ"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("&lt;.*&gt;"), "z") = "z\nz" * StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\nz"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("&lt;.*&gt;", Pattern.DOTALL), "z") = "z" * StringUtils.replaceAll("<__>\n<__>", Pattern.compile("<.*>", Pattern.DOTALL), "z") = "z"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("(?s)&lt;.*&gt;"), "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-z]"), "_") = "ABC___123"
* StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123" * StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "_") = "ABC_123"
* StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123" * StringUtils.replaceAll("ABCabc123", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123"
* StringUtils.replaceAll("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum_dolor_sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression pattern to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceAll(null, *, *) = null * StringUtils.replaceAll(null, *, *) = null
* StringUtils.replaceAll("any", (String) null, *) = "any" * StringUtils.replaceAll("any", (String) null, *) = "any"
* StringUtils.replaceAll("any", *, null) = "any" * StringUtils.replaceAll("any", *, null) = "any"
@ -312,13 +312,13 @@ public class RegExUtils {
* StringUtils.replaceAll("", ".*", "zzz") = "zzz" * StringUtils.replaceAll("", ".*", "zzz") = "zzz"
* StringUtils.replaceAll("", ".+", "zzz") = "" * StringUtils.replaceAll("", ".+", "zzz") = ""
* StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ" * StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z\nz" * StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "(?s)&lt;.*&gt;", "z") = "z" * StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
* StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123" * StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123"
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123" * StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123" * StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
* StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceFirst(null, *, *) = null * StringUtils.replaceFirst(null, *, *) = null
* StringUtils.replaceFirst("any", (Pattern) null, *) = "any" * StringUtils.replaceFirst("any", (Pattern) null, *) = "any"
* StringUtils.replaceFirst("any", *, 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") = "zzz"
* StringUtils.replaceFirst("", Pattern.compile(".+"), "zzz") = "" * StringUtils.replaceFirst("", Pattern.compile(".+"), "zzz") = ""
* StringUtils.replaceFirst("abc", Pattern.compile(""), "ZZ") = "ZZabc" * StringUtils.replaceFirst("abc", Pattern.compile(""), "ZZ") = "ZZabc"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("&lt;.*&gt;"), "z") = "z\n&lt;__&gt;" * StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("<.*>"), "z") = "z\n<__>"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", Pattern.compile("(?s)&lt;.*&gt;"), "z") = "z" * StringUtils.replaceFirst("<__>\n<__>", Pattern.compile("(?s)<.*>"), "z") = "z"
* StringUtils.replaceFirst("ABCabc123", Pattern.compile("[a-z]"), "_") = "ABC_bc123" * 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]+"), "_") = "ABC_123abc"
* StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123abc" * StringUtils.replaceFirst("ABCabc123abc", Pattern.compile("[^A-Z0-9]+"), "") = "ABC123abc"
* StringUtils.replaceFirst("Lorem ipsum dolor sit", Pattern.compile("( +)([a-z]+)"), "_$2") = "Lorem_ipsum dolor sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression pattern to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceFirst(null, *, *) = null * StringUtils.replaceFirst(null, *, *) = null
* StringUtils.replaceFirst("any", (String) null, *) = "any" * StringUtils.replaceFirst("any", (String) null, *) = "any"
* StringUtils.replaceFirst("any", *, null) = "any" * StringUtils.replaceFirst("any", *, null) = "any"
@ -408,13 +408,13 @@ public class RegExUtils {
* StringUtils.replaceFirst("", ".*", "zzz") = "zzz" * StringUtils.replaceFirst("", ".*", "zzz") = "zzz"
* StringUtils.replaceFirst("", ".+", "zzz") = "" * StringUtils.replaceFirst("", ".+", "zzz") = ""
* StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc" * StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z\n&lt;__&gt;" * StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", "(?s)&lt;.*&gt;", "z") = "z" * StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
* StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123" * StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123"
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc" * StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc"
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc" * StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc"
* StringUtils.replaceFirst("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum dolor sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replacePattern(null, *, *) = null * StringUtils.replacePattern(null, *, *) = null
* StringUtils.replacePattern("any", (String) null, *) = "any" * StringUtils.replacePattern("any", (String) null, *) = "any"
* StringUtils.replacePattern("any", *, null) = "any" * StringUtils.replacePattern("any", *, null) = "any"
* StringUtils.replacePattern("", "", "zzz") = "zzz" * StringUtils.replacePattern("", "", "zzz") = "zzz"
* StringUtils.replacePattern("", ".*", "zzz") = "zzz" * StringUtils.replacePattern("", ".*", "zzz") = "zzz"
* StringUtils.replacePattern("", ".+", "zzz") = "" * StringUtils.replacePattern("", ".+", "zzz") = ""
* StringUtils.replacePattern("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z" * StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
* StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123" * StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123"
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123" * StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123" * StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
* StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit" * StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
* </pre> * }</pre>
* *
* @param text * @param text
* the source string * the source string

View File

@ -41,8 +41,8 @@ import org.apache.commons.lang3.Functions.FailablePredicate;
* specifically, it attempts to address the fact that lambdas are supposed * specifically, it attempts to address the fact that lambdas are supposed
* not to throw Exceptions, at least not checked Exceptions, AKA instances * not to throw Exceptions, at least not checked Exceptions, AKA instances
* of {@link Exception}. This enforces the use of constructs like * of {@link Exception}. This enforces the use of constructs like
* <pre> * <pre>{@code
* Consumer&lt;java.lang.reflect.Method&gt; consumer = m -&gt; { * Consumer<java.lang.reflect.Method> consumer = m -> {
* try { * try {
* m.invoke(o, args); * m.invoke(o, args);
* } catch (Throwable t) { * } catch (Throwable t) {
@ -50,10 +50,10 @@ import org.apache.commons.lang3.Functions.FailablePredicate;
* } * }
* }; * };
* stream.forEach(consumer); * stream.forEach(consumer);
* </pre> * }</pre>
* Using a {@link FailableStream}, this can be rewritten as follows: * Using a {@link FailableStream}, this can be rewritten as follows:
* <pre> * <pre>
* Streams.failable(stream).forEach((m) -&gt; m.invoke(o, args)); * Streams.failable(stream).forEach((m) -> m.invoke(o, args));
* </pre> * </pre>
* Obviously, the second version is much more concise and the spirit of * Obviously, the second version is much more concise and the spirit of
* Lambda expressions is met better than in the first version. * 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 FailableConsumer} may be applied, instead of
* {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is * {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is
* to rewrite a code snippet like this: * to rewrite a code snippet like this:
* <pre> * <pre>{@code
* final List&lt;O&gt; list; * final List<O> list;
* final Method m; * final Method m;
* final Function&lt;O,String&gt; mapper = (o) -&gt; { * final Function<O,String> mapper = (o) -> {
* try { * try {
* return (String) m.invoke(o); * return (String) m.invoke(o);
* } catch (Throwable t) { * } catch (Throwable t) {
* throw Functions.rethrow(t); * throw Functions.rethrow(t);
* } * }
* }; * };
* final List&lt;String&gt; strList = list.stream() * final List<String> strList = list.stream()
* .map(mapper).collect(Collectors.toList()); * .map(mapper).collect(Collectors.toList());
* </pre> * }</pre>
* as follows: * as follows:
* <pre> * <pre>{@code
* final List&lt;O&gt; list; * final List<O> list;
* final Method m; * final Method m;
* final List&lt;String&gt; strList = Functions.stream(list.stream()) * final List<String> strList = Functions.stream(list.stream())
* .map((o) -&gt; (String) m.invoke(o)).collect(Collectors.toList()); * .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
* </pre> * }</pre>
* While the second version may not be <em>quite</em> as * While the second version may not be <em>quite</em> as
* efficient (because it depends on the creation of additional, * efficient (because it depends on the creation of additional,
* intermediate objects, of type FailableStream), it is much more * intermediate objects, of type FailableStream), it is much more
@ -502,26 +502,26 @@ public class Streams {
* {@link FailableConsumer} may be applied, instead of * {@link FailableConsumer} may be applied, instead of
* {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is * {@link Predicate}, {@link Function}, or {@link Consumer}. The idea is
* to rewrite a code snippet like this: * to rewrite a code snippet like this:
* <pre> * <pre>{@code
* final List&lt;O&gt; list; * final List<O> list;
* final Method m; * final Method m;
* final Function&lt;O,String&gt; mapper = (o) -&gt; { * final Function<O,String> mapper = (o) -> {
* try { * try {
* return (String) m.invoke(o); * return (String) m.invoke(o);
* } catch (Throwable t) { * } catch (Throwable t) {
* throw Functions.rethrow(t); * throw Functions.rethrow(t);
* } * }
* }; * };
* final List&lt;String&gt; strList = list.stream() * final List<String> strList = list.stream()
* .map(mapper).collect(Collectors.toList()); * .map(mapper).collect(Collectors.toList());
* </pre> * }</pre>
* as follows: * as follows:
* <pre> * <pre>{@code
* final List&lt;O&gt; list; * final List<O> list;
* final Method m; * final Method m;
* final List&lt;String&gt; strList = Functions.stream(list.stream()) * final List<String> strList = Functions.stream(list.stream())
* .map((o) -&gt; (String) m.invoke(o)).collect(Collectors.toList()); * .map((o) -> (String) m.invoke(o)).collect(Collectors.toList());
* </pre> * }</pre>
* While the second version may not be <em>quite</em> as * While the second version may not be <em>quite</em> as
* efficient (because it depends on the creation of additional, * efficient (because it depends on the creation of additional,
* intermediate objects, of type FailableStream), it is much more * intermediate objects, of type FailableStream), it is much more

View File

@ -801,16 +801,16 @@ public class StringUtils {
* <p>{@code null} value is considered less than non-{@code null} value. * <p>{@code null} value is considered less than non-{@code null} value.
* Two {@code null} references are considered equal.</p> * Two {@code null} references are considered equal.</p>
* *
* <pre> * <pre>{@code
* StringUtils.compare(null, null) = 0 * StringUtils.compare(null, null) = 0
* StringUtils.compare(null , "a") &lt; 0 * StringUtils.compare(null , "a") < 0
* StringUtils.compare("a", null) &gt; 0 * StringUtils.compare("a", null) > 0
* StringUtils.compare("abc", "abc") = 0 * StringUtils.compare("abc", "abc") = 0
* StringUtils.compare("a", "b") &lt; 0 * StringUtils.compare("a", "b") < 0
* StringUtils.compare("b", "a") &gt; 0 * StringUtils.compare("b", "a") > 0
* StringUtils.compare("a", "B") &gt; 0 * StringUtils.compare("a", "B") > 0
* StringUtils.compare("ab", "abc") &lt; 0 * StringUtils.compare("ab", "abc") < 0
* </pre> * }</pre>
* *
* @see #compare(String, String, boolean) * @see #compare(String, String, boolean)
* @see String#compareTo(String) * @see String#compareTo(String)
@ -837,18 +837,18 @@ public class StringUtils {
* <p>{@code null} inputs are handled according to the {@code nullIsLess} parameter. * <p>{@code null} inputs are handled according to the {@code nullIsLess} parameter.
* Two {@code null} references are considered equal.</p> * Two {@code null} references are considered equal.</p>
* *
* <pre> * <pre>{@code
* StringUtils.compare(null, null, *) = 0 * StringUtils.compare(null, null, *) = 0
* StringUtils.compare(null , "a", true) &lt; 0 * StringUtils.compare(null , "a", true) < 0
* StringUtils.compare(null , "a", false) &gt; 0 * StringUtils.compare(null , "a", false) > 0
* StringUtils.compare("a", null, true) &gt; 0 * StringUtils.compare("a", null, true) > 0
* StringUtils.compare("a", null, false) &lt; 0 * StringUtils.compare("a", null, false) < 0
* StringUtils.compare("abc", "abc", *) = 0 * StringUtils.compare("abc", "abc", *) = 0
* StringUtils.compare("a", "b", *) &lt; 0 * StringUtils.compare("a", "b", *) < 0
* StringUtils.compare("b", "a", *) &gt; 0 * StringUtils.compare("b", "a", *) > 0
* StringUtils.compare("a", "B", *) &gt; 0 * StringUtils.compare("a", "B", *) > 0
* StringUtils.compare("ab", "abc", *) &lt; 0 * StringUtils.compare("ab", "abc", *) < 0
* </pre> * }</pre>
* *
* @see String#compareTo(String) * @see String#compareTo(String)
* @param str1 the String to compare from * @param str1 the String to compare from
@ -886,18 +886,18 @@ public class StringUtils {
* Two {@code null} references are considered equal. * Two {@code null} references are considered equal.
* Comparison is case insensitive.</p> * Comparison is case insensitive.</p>
* *
* <pre> * <pre>{@code
* StringUtils.compareIgnoreCase(null, null) = 0 * StringUtils.compareIgnoreCase(null, null) = 0
* StringUtils.compareIgnoreCase(null , "a") &lt; 0 * StringUtils.compareIgnoreCase(null , "a") < 0
* StringUtils.compareIgnoreCase("a", null) &gt; 0 * StringUtils.compareIgnoreCase("a", null) > 0
* StringUtils.compareIgnoreCase("abc", "abc") = 0 * StringUtils.compareIgnoreCase("abc", "abc") = 0
* StringUtils.compareIgnoreCase("abc", "ABC") = 0 * StringUtils.compareIgnoreCase("abc", "ABC") = 0
* StringUtils.compareIgnoreCase("a", "b") &lt; 0 * StringUtils.compareIgnoreCase("a", "b") < 0
* StringUtils.compareIgnoreCase("b", "a") &gt; 0 * StringUtils.compareIgnoreCase("b", "a") > 0
* StringUtils.compareIgnoreCase("a", "B") &lt; 0 * StringUtils.compareIgnoreCase("a", "B") < 0
* StringUtils.compareIgnoreCase("A", "b") &lt; 0 * StringUtils.compareIgnoreCase("A", "b") < 0
* StringUtils.compareIgnoreCase("ab", "ABC") &lt; 0 * StringUtils.compareIgnoreCase("ab", "ABC") < 0
* </pre> * }</pre>
* *
* @see #compareIgnoreCase(String, String, boolean) * @see #compareIgnoreCase(String, String, boolean)
* @see String#compareToIgnoreCase(String) * @see String#compareToIgnoreCase(String)
@ -927,20 +927,20 @@ public class StringUtils {
* Two {@code null} references are considered equal. * Two {@code null} references are considered equal.
* Comparison is case insensitive.</p> * Comparison is case insensitive.</p>
* *
* <pre> * <pre>{@code
* StringUtils.compareIgnoreCase(null, null, *) = 0 * StringUtils.compareIgnoreCase(null, null, *) = 0
* StringUtils.compareIgnoreCase(null , "a", true) &lt; 0 * StringUtils.compareIgnoreCase(null , "a", true) < 0
* StringUtils.compareIgnoreCase(null , "a", false) &gt; 0 * StringUtils.compareIgnoreCase(null , "a", false) > 0
* StringUtils.compareIgnoreCase("a", null, true) &gt; 0 * StringUtils.compareIgnoreCase("a", null, true) > 0
* StringUtils.compareIgnoreCase("a", null, false) &lt; 0 * StringUtils.compareIgnoreCase("a", null, false) < 0
* StringUtils.compareIgnoreCase("abc", "abc", *) = 0 * StringUtils.compareIgnoreCase("abc", "abc", *) = 0
* StringUtils.compareIgnoreCase("abc", "ABC", *) = 0 * StringUtils.compareIgnoreCase("abc", "ABC", *) = 0
* StringUtils.compareIgnoreCase("a", "b", *) &lt; 0 * StringUtils.compareIgnoreCase("a", "b", *) < 0
* StringUtils.compareIgnoreCase("b", "a", *) &gt; 0 * StringUtils.compareIgnoreCase("b", "a", *) > 0
* StringUtils.compareIgnoreCase("a", "B", *) &lt; 0 * StringUtils.compareIgnoreCase("a", "B", *) < 0
* StringUtils.compareIgnoreCase("A", "b", *) &lt; 0 * StringUtils.compareIgnoreCase("A", "b", *) < 0
* StringUtils.compareIgnoreCase("ab", "abc", *) &lt; 0 * StringUtils.compareIgnoreCase("ab", "abc", *) < 0
* </pre> * }</pre>
* *
* @see String#compareToIgnoreCase(String) * @see String#compareToIgnoreCase(String)
* @param str1 the String to compare from * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeAll(null, *) = null * StringUtils.removeAll(null, *) = null
* StringUtils.removeAll("any", (String) null) = "any" * StringUtils.removeAll("any", (String) null) = "any"
* StringUtils.removeAll("any", "") = "any" * StringUtils.removeAll("any", "") = "any"
* StringUtils.removeAll("any", ".*") = "" * StringUtils.removeAll("any", ".*") = ""
* StringUtils.removeAll("any", ".+") = "" * StringUtils.removeAll("any", ".+") = ""
* StringUtils.removeAll("abc", ".?") = "" * StringUtils.removeAll("abc", ".?") = ""
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "A\nB" * StringUtils.removeAll("A<__>\n<__>B", "<.*>") = "A\nB"
* StringUtils.removeAll("A&lt;__&gt;\n&lt;__&gt;B", "(?s)&lt;.*&gt;") = "AB" * StringUtils.removeAll("A<__>\n<__>B", "(?s)<.*>") = "AB"
* StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123" * StringUtils.removeAll("ABCabc123abc", "[a-z]") = "ABC123"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removeFirst(null, *) = null * StringUtils.removeFirst(null, *) = null
* StringUtils.removeFirst("any", (String) null) = "any" * StringUtils.removeFirst("any", (String) null) = "any"
* StringUtils.removeFirst("any", "") = "any" * StringUtils.removeFirst("any", "") = "any"
* StringUtils.removeFirst("any", ".*") = "" * StringUtils.removeFirst("any", ".*") = ""
* StringUtils.removeFirst("any", ".+") = "" * StringUtils.removeFirst("any", ".+") = ""
* StringUtils.removeFirst("abc", ".?") = "bc" * StringUtils.removeFirst("abc", ".?") = "bc"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "A\n&lt;__&gt;B" * StringUtils.removeFirst("A<__>\n<__>B", "<.*>") = "A\n<__>B"
* StringUtils.removeFirst("A&lt;__&gt;\n&lt;__&gt;B", "(?s)&lt;.*&gt;") = "AB" * StringUtils.removeFirst("A<__>\n<__>B", "(?s)<.*>") = "AB"
* StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123" * StringUtils.removeFirst("ABCabc123", "[a-z]") = "ABCbc123"
* StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc" * StringUtils.removeFirst("ABCabc123abc", "[a-z]+") = "ABC123abc"
* </pre> * }</pre>
* *
* @param text text to remove from, may be null * @param text text to remove from, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.removePattern(null, *) = null * StringUtils.removePattern(null, *) = null
* StringUtils.removePattern("any", (String) null) = "any" * StringUtils.removePattern("any", (String) null) = "any"
* StringUtils.removePattern("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "AB" * StringUtils.removePattern("A<__>\n<__>B", "<.*>") = "AB"
* StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123" * StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123"
* </pre> * }</pre>
* *
* @param source * @param source
* the source string * the source string
@ -6458,7 +6458,7 @@ public class StringUtils {
* To use the DOTALL option prepend {@code "(?s)"} to the regex. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceAll(null, *, *) = null * StringUtils.replaceAll(null, *, *) = null
* StringUtils.replaceAll("any", (String) null, *) = "any" * StringUtils.replaceAll("any", (String) null, *) = "any"
* StringUtils.replaceAll("any", *, null) = "any" * StringUtils.replaceAll("any", *, null) = "any"
@ -6466,13 +6466,13 @@ public class StringUtils {
* StringUtils.replaceAll("", ".*", "zzz") = "zzz" * StringUtils.replaceAll("", ".*", "zzz") = "zzz"
* StringUtils.replaceAll("", ".+", "zzz") = "" * StringUtils.replaceAll("", ".+", "zzz") = ""
* StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ" * StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z\nz" * StringUtils.replaceAll("<__>\n<__>", "<.*>", "z") = "z\nz"
* StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "(?s)&lt;.*&gt;", "z") = "z" * StringUtils.replaceAll("<__>\n<__>", "(?s)<.*>", "z") = "z"
* StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123" * StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123"
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123" * StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
* StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123" * StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
* StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression to which this string is to be matched * @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. * To use the DOTALL option prepend {@code "(?s)"} to the regex.
* DOTALL is also known as single-line mode in Perl.</p> * DOTALL is also known as single-line mode in Perl.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replaceFirst(null, *, *) = null * StringUtils.replaceFirst(null, *, *) = null
* StringUtils.replaceFirst("any", (String) null, *) = "any" * StringUtils.replaceFirst("any", (String) null, *) = "any"
* StringUtils.replaceFirst("any", *, null) = "any" * StringUtils.replaceFirst("any", *, null) = "any"
@ -6870,13 +6870,13 @@ public class StringUtils {
* StringUtils.replaceFirst("", ".*", "zzz") = "zzz" * StringUtils.replaceFirst("", ".*", "zzz") = "zzz"
* StringUtils.replaceFirst("", ".+", "zzz") = "" * StringUtils.replaceFirst("", ".+", "zzz") = ""
* StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc" * StringUtils.replaceFirst("abc", "", "ZZ") = "ZZabc"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z\n&lt;__&gt;" * StringUtils.replaceFirst("<__>\n<__>", "<.*>", "z") = "z\n<__>"
* StringUtils.replaceFirst("&lt;__&gt;\n&lt;__&gt;", "(?s)&lt;.*&gt;", "z") = "z" * StringUtils.replaceFirst("<__>\n<__>", "(?s)<.*>", "z") = "z"
* StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123" * StringUtils.replaceFirst("ABCabc123", "[a-z]", "_") = "ABC_bc123"
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc" * StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "_") = "ABC_123abc"
* StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc" * StringUtils.replaceFirst("ABCabc123abc", "[^A-Z0-9]+", "") = "ABC123abc"
* StringUtils.replaceFirst("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum dolor sit" * 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 text text to search and replace in, may be null
* @param regex the regular expression to which this string is to be matched * @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> * <p>A {@code null} reference passed to this method is a no-op.</p>
* *
* <pre> * <pre>{@code
* StringUtils.replacePattern(null, *, *) = null * StringUtils.replacePattern(null, *, *) = null
* StringUtils.replacePattern("any", (String) null, *) = "any" * StringUtils.replacePattern("any", (String) null, *) = "any"
* StringUtils.replacePattern("any", *, null) = "any" * StringUtils.replacePattern("any", *, null) = "any"
* StringUtils.replacePattern("", "", "zzz") = "zzz" * StringUtils.replacePattern("", "", "zzz") = "zzz"
* StringUtils.replacePattern("", ".*", "zzz") = "zzz" * StringUtils.replacePattern("", ".*", "zzz") = "zzz"
* StringUtils.replacePattern("", ".+", "zzz") = "" * StringUtils.replacePattern("", ".+", "zzz") = ""
* StringUtils.replacePattern("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z" * StringUtils.replacePattern("<__>\n<__>", "<.*>", "z") = "z"
* StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123" * StringUtils.replacePattern("ABCabc123", "[a-z]", "_") = "ABC___123"
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123" * StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123"
* StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123" * StringUtils.replacePattern("ABCabc123", "[^A-Z0-9]+", "") = "ABC123"
* StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit" * StringUtils.replacePattern("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit"
* </pre> * }</pre>
* *
* @param source * @param source
* the source string * the source string

View File

@ -556,8 +556,8 @@ public class Validate {
* validating according to an arbitrary boolean expression, such as validating a * validating according to an arbitrary boolean expression, such as validating a
* primitive number or using your own custom validation expression. * primitive number or using your own custom validation expression.
* *
* <pre> * <pre>{@code
* Validate.isTrue(i &gt;= min &amp;&amp; i &lt;= max, "The value must be between &#37;d and &#37;d", min, max);</pre> * Validate.isTrue(i >= min &amp;&amp; i <= max, "The value must be between %d and %d", min, max);}</pre>
* *
* @param expression the boolean expression to check * @param expression the boolean expression to check
* @param message the {@link String#format(String, Object...)} exception message if invalid, not null * @param message the {@link String#format(String, Object...)} exception message if invalid, not null

View File

@ -1248,11 +1248,12 @@ public class StrBuilder implements CharSequence, Appendable, Serializable, Build
* This method is useful for adding a separator each time around the * This method is useful for adding a separator each time around the
* loop except the first. * loop except the first.
* </p> * </p>
* <pre> * <pre>{@code
* for (int i = 0; i &lt; list.size(); i++) { * for (int i = 0; i < list.size(); i++) {
* appendSeparator(",", i); * appendSeparator(",", i);
* append(list.get(i)); * append(list.get(i));
* } * }
* }
* </pre> * </pre>
* Note that for this simple example, you should use * Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}. * {@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 * This method is useful for adding a separator each time around the
* loop except the first. * loop except the first.
* </p> * </p>
* <pre> * <pre>{@code
* for (int i = 0; i &lt; list.size(); i++) { * for (int i = 0; i < list.size(); i++) {
* appendSeparator(",", i); * appendSeparator(",", i);
* append(list.get(i)); * append(list.get(i));
* } * }
* </pre> * }</pre>
* Note that for this simple example, you should use * Note that for this simple example, you should use
* {@link #appendWithSeparators(Iterable, String)}. * {@link #appendWithSeparators(Iterable, String)}.
* *

View File

@ -172,11 +172,11 @@ public abstract class StrLookup<V> {
* The {@link #lookup(String)} method always returns a String, regardless of * The {@link #lookup(String)} method always returns a String, regardless of
* the underlying data, by converting it as necessary. For example: * the underlying data, by converting it as necessary. For example:
* </p> * </p>
* <pre> * <pre>{@code
* Map&lt;String, Object&gt; map = new HashMap&lt;String, Object&gt;(); * Map<String, Object> map = new HashMap<String, Object>();
* map.put("number", Integer.valueOf(2)); * map.put("number", Integer.valueOf(2));
* assertEquals("2", StrLookup.mapLookup(map).lookup("number")); * assertEquals("2", StrLookup.mapLookup(map).lookup("number"));
* </pre> * }</pre>
* @param key the key to be looked up, may be null * @param key the key to be looked up, may be null
* @return the matching value, null if no match * @return the matching value, null if no match
*/ */