Fix to be JDK1.2 compliant

git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137106 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2002-10-30 21:58:18 +00:00
parent a8df3d5a93
commit 778d8d5828
1 changed files with 6 additions and 2 deletions

View File

@ -115,9 +115,13 @@ import java.util.Map;
* </p> * </p>
* *
* @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a> * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
* @version $Id: Enum.java,v 1.2 2002/08/31 10:51:02 scolebourne Exp $ * @version $Id: Enum.java,v 1.3 2002/10/30 21:58:18 scolebourne Exp $
*/ */
public abstract class Enum implements Comparable, Serializable { public abstract class Enum implements Comparable, Serializable {
/**
* An empty map, as JDK1.2 didn't have an empty map
*/
private static final Map EMPTY_MAP = Collections.unmodifiableMap(new HashMap());
/** /**
* Map, key of class name, value of Entry. * Map, key of class name, value of Entry.
*/ */
@ -210,7 +214,7 @@ public abstract class Enum implements Comparable, Serializable {
} }
Entry entry = (Entry) cEnumClasses.get(enumClass.getName()); Entry entry = (Entry) cEnumClasses.get(enumClass.getName());
if (entry == null) { if (entry == null) {
return Collections.EMPTY_MAP; return EMPTY_MAP;
} }
return Collections.unmodifiableMap(entry.map); return Collections.unmodifiableMap(entry.map);
} }