# Enum

public abstract class **Enum** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
implements [Comparable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Comparable.html)\<E extends [Enum](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html)\<E\>\> [Serializable](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/Serializable.html)

|---|---|---|
| Known Direct Subclasses [AccessMode](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/AccessMode.html), [AclEntryFlag](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryFlag.html), [AclEntryPermission](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryPermission.html), [AclEntryType](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryType.html), [Authenticator.RequestorType](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/Authenticator.RequestorType.html), [CRLReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CRLReason.html), [CertPathValidatorException.BasicReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.BasicReason.html), [Character.UnicodeScript](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.UnicodeScript.html), [ChronoField](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/ChronoField.html), [ChronoUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/ChronoUnit.html), [ClientInfoStatus](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/ClientInfoStatus.html), [Collector.Characteristics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html), [CryptoPrimitive](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/CryptoPrimitive.html), [DayOfWeek](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DayOfWeek.html), [ElementType](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/ElementType.html), and [28 others.](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum#) |---|---| | [AccessMode](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/AccessMode.html) | Defines access modes used to test the accessibility of a file. | | [AclEntryFlag](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryFlag.html) | Defines the flags for used by the flags component of an ACL `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntry.html`. | | [AclEntryPermission](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryPermission.html) | Defines the permissions for use with the permissions component of an ACL `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntry.html`. | | [AclEntryType](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/AclEntryType.html) | A typesafe enumeration of the access control entry types. | | [Authenticator.RequestorType](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/Authenticator.RequestorType.html) | The type of the entity requesting authentication. | | [CRLReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CRLReason.html) | The CRLReason enumeration specifies the reason that a certificate is revoked, as defined in [RFC 3280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile](http://www.ietf.org/rfc/rfc3280.txt). | | [CertPathValidatorException.BasicReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/CertPathValidatorException.BasicReason.html) | The BasicReason enumerates the potential reasons that a certification path of any type may be invalid. | | [Character.UnicodeScript](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.UnicodeScript.html) | A family of character subsets representing the character scripts defined in the [*Unicode Standard Annex #24: Script Names*](http://www.unicode.org/reports/tr24/). | | [ChronoField](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/ChronoField.html) | A standard set of fields. | | [ChronoUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/temporal/ChronoUnit.html) | A standard set of date periods units. | | [ClientInfoStatus](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/ClientInfoStatus.html) | Enumeration for status of the reason that a property could not be set via a call to `Connection.setClientInfo` | | [Collector.Characteristics](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/stream/Collector.Characteristics.html) | Characteristics indicating properties of a `Collector`, which can be used to optimize reduction implementations. | | [CryptoPrimitive](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/CryptoPrimitive.html) | An enumeration of cryptographic primitives. | | [DayOfWeek](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/DayOfWeek.html) | A day-of-week, such as 'Tuesday'. | | [ElementType](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/ElementType.html) | The constants of this enumerated type provide a simple classification of the syntactic locations where annotations may appear in a Java program. | | [FileVisitOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileVisitOption.html) | Defines the file tree traversal options. | | [FileVisitResult](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileVisitResult.html) | The result type of a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/FileVisitor.html`. | | [FormatStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/FormatStyle.html) | Enumeration of the style of a localized date, time or date-time formatter. | | [Formatter.BigDecimalLayoutForm](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Formatter.BigDecimalLayoutForm.html) | Enum for `BigDecimal` formatting. | | [IsoEra](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/chrono/IsoEra.html) | An era in the ISO calendar system. | | [KeyRep.Type](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/KeyRep.Type.html) | Key type. | | [LinkOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/LinkOption.html) | Defines the options as to how symbolic links are handled. | | [Locale.Category](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.Category.html) | Enum for locale categories. | | [Locale.FilteringMode](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Locale.FilteringMode.html) | This enum provides constants to select a filtering mode for locale matching. | | [Month](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/Month.html) | A month-of-year, such as 'July'. | | [Normalizer.Form](https://developers.google.com/j2objc/javadoc/jre/reference/java/text/Normalizer.Form.html) | The normalization forms supported by the Normalizer. | | [NumericShaper.Range](https://developers.google.com/j2objc/javadoc/jre/reference/java/awt/font/NumericShaper.Range.html) | A `NumericShaper.Range` represents a Unicode range of a script having its own decimal digits. | | [PKIXReason](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXReason.html) | The `PKIXReason` enumerates the potential PKIX-specific reasons that an X.509 certification path may be invalid according to the PKIX (RFC 3280) standard. | | [PKIXRevocationChecker.Option](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/cert/PKIXRevocationChecker.Option.html) | Various revocation options that can be specified for the revocation checking mechanism. | | [PosixFilePermission](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/PosixFilePermission.html) | Defines the bits for use with the `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/attribute/PosixFileAttributes.html#permissions()` attribute. | | [Proxy.Type](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/Proxy.Type.html) | Represents the proxy type. | | [ResolverStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/ResolverStyle.html) | Enumeration of different ways to resolve dates and times. | | [RetentionPolicy](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/annotation/RetentionPolicy.html) | Annotation retention policy. | | [RowIdLifetime](https://developers.google.com/j2objc/javadoc/jre/reference/java/sql/RowIdLifetime.html) | Enumeration for RowId life-time values. | | [SSLEngineResult.HandshakeStatus](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngineResult.HandshakeStatus.html) | An `SSLEngineResult` enum describing the current handshaking state of this `SSLEngine`. | | [SSLEngineResult.Status](https://developers.google.com/j2objc/javadoc/jre/reference/javax/net/ssl/SSLEngineResult.Status.html) | An `SSLEngineResult` enum describing the overall result of the `SSLEngine` operation. | | [SignStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/SignStyle.html) | Enumeration of ways to handle the positive/negative sign. | | [StandardCopyOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/StandardCopyOption.html) | Defines the standard copy options. | | [StandardOpenOption](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/StandardOpenOption.html) | Defines the standard open options. | | [StandardProtocolFamily](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/StandardProtocolFamily.html) | Defines the standard families of communication protocols. | | [TextStyle](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/format/TextStyle.html) | Enumeration of the style of text formatting and parsing. | | [TimeUnit](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/concurrent/TimeUnit.html) | A `TimeUnit` represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units. | | [ZoneOffsetTransitionRule.TimeDefinition](https://developers.google.com/j2objc/javadoc/jre/reference/java/time/zone/ZoneOffsetTransitionRule.TimeDefinition.html) | A definition of the way a local time can be converted to the actual transition date-time. | |||

This is the common base class of all Java language enumeration types.

More information about enums, including descriptions of the
implicitly declared methods synthesized by the compiler, can be
found in section 8.9 of
The Java™ Language Specification.

Note that when using an enumeration type as the type of a set
or as the type of the keys in a map, specialized and efficient
{@linkplain java.util.EnumSet set} and {@linkplain java.util.EnumMap map} implementations are available.

##### See Also

- `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html#getEnumConstants()`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/EnumSet.html`
- `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/EnumMap.html`

### Protected Constructor Summary

|---|---|
|   | [Enum](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#Enum(java.lang.String,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, int ordinal) Sole constructor. |

### Public Method Summary

|---|---|
| final int | [compareTo](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#compareTo(E))(E o) Compares this enum with the specified object for order. |
| final boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other) Returns true if the specified object is equal to this enum constant. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<E\> | [getDeclaringClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#getDeclaringClass())() Returns the Class object corresponding to this enum constant's enum type. |
| final int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#hashCode())() Returns a hash code for this enum constant. |
| final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [name](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#name())() Returns the name of this enum constant, exactly as declared in its enum declaration. |
| final int | [ordinal](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#ordinal())() Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#toString())() Returns the name of this enum constant, as contained in the declaration. |
| static \<T extends [Enum](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html)\<T\>\> T | [valueOf](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#valueOf(java.lang.Class<T>,%20java.lang.String))([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<T\> enumType, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name) Returns the enum constant of the specified enum type with the specified name. |

### Protected Method Summary

|---|---|
| final [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#clone())() Throws CloneNotSupportedException. |
| final void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#finalize())() enum classes cannot have finalize methods. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

From interface [java.lang.Comparable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Comparable.html)

|---|---|
| abstract int | [compareTo](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Comparable.html#compareTo(T))(E extends [Enum](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html)\<E\> o) Compares this object with the specified object for order. |

## Protected Constructors

#### protected
**Enum**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name, int ordinal)

Sole constructor. Programmers cannot invoke this constructor.
It is for use by code emitted by the compiler in response to
enum type declarations.

##### Parameters

| name | - The name of this enum constant, which is the identifier used to declare it. |
| ordinal | - The ordinal of this enumeration constant (its position in the enum declaration, where the initial constant is assigned an ordinal of zero). |
|---|---|

## Public Methods

#### public final int
**compareTo**
(E o)

Compares this enum with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.

Enum constants are only comparable to other enum constants of the
same enum type. The natural order implemented by this
method is the order in which the constants are declared.

##### Parameters

| o |   |
|---|---|

#### public final boolean
**equals**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) other)

Returns true if the specified object is equal to this
enum constant.

##### Parameters

| other | the object to be compared for equality with this object. |
|---|---|

##### Returns

- true if the specified object is equal to this enum constant.

#### public final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<E\>
**getDeclaringClass**
()

Returns the Class object corresponding to this enum constant's
enum type. Two enum constants e1 and e2 are of the
same enum type if and only if
e1.getDeclaringClass() == e2.getDeclaringClass().
(The value returned by this method may differ from the one returned
by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass()` method for enum constants with
constant-specific class bodies.)

##### Returns

- the Class object corresponding to this enum constant's enum type

#### public final int
**hashCode**
()

Returns a hash code for this enum constant.

##### Returns

- a hash code for this enum constant.

#### public final [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**name**
()

Returns the name of this enum constant, exactly as declared in its
enum declaration.

**Most programmers should use the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Enum.html#toString()` method in
preference to this one, as the toString method may return
a more user-friendly name.** This method is designed primarily for
use in specialized situations where correctness depends on getting the
exact name, which will not vary from release to release.

##### Returns

- the name of this enum constant

#### public final int
**ordinal**
()

Returns the ordinal of this enumeration constant (its position
in its enum declaration, where the initial constant is assigned
an ordinal of zero).

Most programmers will have no use for this method. It is
designed for use by sophisticated enum-based data structures, such
as `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/EnumSet.html` and `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/EnumMap.html`.

##### Returns

- the ordinal of this enumeration constant

#### public [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toString**
()

Returns the name of this enum constant, as contained in the
declaration. This method may be overridden, though it typically
isn't necessary or desirable. An enum type should override this
method when a more "programmer-friendly" string form exists.

##### Returns

- the name of this enum constant

#### public static T
**valueOf**
([Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<T\> enumType, [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) name)

Returns the enum constant of the specified enum type with the
specified name. The name must match exactly an identifier used
to declare an enum constant in this type. (Extraneous whitespace
characters are not permitted.)

Note that for a particular enum type `T`, the
implicitly declared `public static T valueOf(String)`
method on that enum may be used instead of this method to map
from a name to the corresponding enum constant. All the
constants of an enum type can be obtained by calling the
implicit `public static T[] values()` method of that
type.

##### Parameters

| enumType | the `Class` object of the enum type from which to return a constant |
| name | the name of the constant to return |
|---|---|

##### Returns

- the enum constant of the specified enum type with the specified name

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if the specified enum type has no constant with the specified name, or the specified class object does not represent an enum type |
| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if `enumType` or `name` is null |
|---|---|

## Protected Methods

#### protected final [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)
**clone**
()

Throws CloneNotSupportedException. This guarantees that enums
are never cloned, which is necessary to preserve their "singleton"
status.

##### Returns

- (never returns)

##### Throws

| [CloneNotSupportedException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/CloneNotSupportedException.html) |   |
|---|---|

#### protected final void
**finalize**
()

enum classes cannot have finalize methods.