Author: mbenson Date: Sun Apr 3 17:14:50 2011 New Revision: 1088339 URL: http://svn.apache.org/viewvc?rev=1088339&view=rev Log: merge CharSet getInstance/constructor String[] and String forms to String...
Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java Modified: commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java?rev=1088339&r1=1088338&r2=1088339&view=diff ============================================================================== --- commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java (original) +++ commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/CharSet.java Sun Apr 3 17:14:50 2011 @@ -135,53 +135,32 @@ public class CharSet implements Serializ * * <p>All CharSet objects returned by this method will be immutable.</p> * - * @param setStr the String describing the set, may be null - * @return a CharSet instance - * @since 2.0 - */ - public static CharSet getInstance(String setStr) { - Object set = COMMON.get(setStr); - if (set != null) { - return (CharSet) set; - } - return new CharSet(setStr); - } - - /** - * <p>Constructs a new CharSet using the set syntax. - * Each string is merged in with the set.</p> - * - * @param setStrs Strings to merge into the initial set, may be null + * @param setStrs Strings to merge into the set, may be null * @return a CharSet instance * @since 2.4 */ - public static CharSet getInstance(String[] setStrs) { + public static CharSet getInstance(String... setStrs) { if (setStrs == null) { return null; } + if (setStrs.length == 1) { + CharSet common = COMMON.get(setStrs[0]); + if (common != null) { + return common; + } + } return new CharSet(setStrs); } //----------------------------------------------------------------------- /** - * <p>Constructs a new CharSet using the set syntax.</p> - * - * @param setStr the String describing the set, may be null - * @since 2.0 - */ - protected CharSet(String setStr) { - super(); - add(setStr); - } - - /** * <p>Constructs a new CharSet using the set syntax. * Each string is merged in with the set.</p> * * @param set Strings to merge into the initial set * @throws NullPointerException if set is {@code null} */ - protected CharSet(String[] set) { + protected CharSet(String... set) { super(); int sz = set.length; for (int i = 0; i < sz; i++) {