Genericize; add final qualifier to private var

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@754678 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-03-15 15:27:48 +00:00
parent d85758d688
commit ebfe3a9c1d
1 changed files with 5 additions and 5 deletions

View File

@ -79,7 +79,7 @@ public class CharSet implements Serializable {
* Subclasses can add more common patterns if desired. * Subclasses can add more common patterns if desired.
* @since 2.0 * @since 2.0
*/ */
protected static final Map COMMON = new HashMap(); protected static final Map<String, CharSet> COMMON = new HashMap<String, CharSet>();
static { static {
COMMON.put(null, EMPTY); COMMON.put(null, EMPTY);
@ -92,7 +92,7 @@ public class CharSet implements Serializable {
} }
/** The set of CharRange objects. */ /** The set of CharRange objects. */
private Set set = new HashSet(); private final Set<CharRange> set = new HashSet<CharRange>();
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
/** /**
@ -231,7 +231,7 @@ public class CharSet implements Serializable {
* @since 2.0 * @since 2.0
*/ */
public CharRange[] getCharRanges() { public CharRange[] getCharRanges() {
return (CharRange[]) set.toArray(new CharRange[set.size()]); return set.toArray(new CharRange[set.size()]);
} }
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
@ -243,8 +243,8 @@ public class CharSet implements Serializable {
* @return <code>true</code> if the set contains the characters * @return <code>true</code> if the set contains the characters
*/ */
public boolean contains(char ch) { public boolean contains(char ch) {
for (Iterator it = set.iterator(); it.hasNext();) { for (Iterator<CharRange> it = set.iterator(); it.hasNext();) {
CharRange range = (CharRange) it.next(); CharRange range = it.next();
if (range.contains(ch)) { if (range.contains(ch)) {
return true; return true;
} }