Vararging more methods. StringUtils.getCommonPrefix, StringUtils.indexOfDifference, WordUtils.initials, WordUtils.uncapitalize, WordUtils.capitalizeFully, WordUtils.capitalize, BooleanUtils.xor. LANG-396
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@925967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c6e919e65
commit
a22c0543d8
|
@ -887,7 +887,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is <code>null</code>
|
||||
* @throws IllegalArgumentException if <code>array</code> is empty.
|
||||
*/
|
||||
public static boolean xor(boolean[] array) {
|
||||
public static boolean xor(boolean... array) {
|
||||
// Validates input
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
|
@ -928,7 +928,7 @@ public class BooleanUtils {
|
|||
* @throws IllegalArgumentException if <code>array</code> is empty.
|
||||
* @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
|
||||
*/
|
||||
public static Boolean xor(Boolean[] array) {
|
||||
public static Boolean xor(Boolean... array) {
|
||||
if (array == null) {
|
||||
throw new IllegalArgumentException("The Array must not be null");
|
||||
} else if (array.length == 0) {
|
||||
|
|
|
@ -5761,7 +5761,7 @@ public class StringUtils {
|
|||
* @return the index where the strings begin to differ; -1 if they are all equal
|
||||
* @since 2.4
|
||||
*/
|
||||
public static int indexOfDifference(CharSequence[] css) {
|
||||
public static int indexOfDifference(CharSequence... css) {
|
||||
if (css == null || css.length <= 1) {
|
||||
return INDEX_NOT_FOUND;
|
||||
}
|
||||
|
@ -5852,7 +5852,7 @@ public class StringUtils {
|
|||
* or if there is no common prefix.
|
||||
* @since 2.4
|
||||
*/
|
||||
public static String getCommonPrefix(String[] strs) {
|
||||
public static String getCommonPrefix(String... strs) {
|
||||
if (strs == null || strs.length == 0) {
|
||||
return EMPTY;
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ public class WordUtils {
|
|||
* @see #capitalizeFully(String)
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String capitalize(String str, char[] delimiters) {
|
||||
public static String capitalize(String str, char... delimiters) {
|
||||
int delimLen = (delimiters == null ? -1 : delimiters.length);
|
||||
if (str == null || str.length() == 0 || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -275,7 +275,7 @@ public class WordUtils {
|
|||
* @return capitalized String, <code>null</code> if null String input
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String capitalizeFully(String str, char[] delimiters) {
|
||||
public static String capitalizeFully(String str, char... delimiters) {
|
||||
int delimLen = (delimiters == null ? -1 : delimiters.length);
|
||||
if (str == null || str.length() == 0 || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -331,7 +331,7 @@ public class WordUtils {
|
|||
* @see #capitalize(String)
|
||||
* @since 2.1
|
||||
*/
|
||||
public static String uncapitalize(String str, char[] delimiters) {
|
||||
public static String uncapitalize(String str, char... delimiters) {
|
||||
int delimLen = (delimiters == null ? -1 : delimiters.length);
|
||||
if (str == null || str.length() == 0 || delimLen == 0) {
|
||||
return str;
|
||||
|
@ -464,7 +464,7 @@ public class WordUtils {
|
|||
* @see #initials(String)
|
||||
* @since 2.2
|
||||
*/
|
||||
public static String initials(String str, char[] delimiters) {
|
||||
public static String initials(String str, char... delimiters) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return str;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue