public enum Country extends Enum<Country>
Copyright © Enremmeta LLC 2015. All Rights Reserved.
Enum Constant and Description |
---|
UnitedStates |
Modifier and Type | Field and Description |
---|---|
private String |
abbreviation
The state's abbreviation.
|
private static Map<String,Country> |
COUNTRIES_BY_ABBR
The set of states addressed by abbreviations.
|
private String |
name
The state's name.
|
Modifier and Type | Method and Description |
---|---|
String |
getAbbreviation()
Returns the state's abbreviation.
|
static String |
nameByAbbreviation(String abbr) |
String |
toString() |
static Country |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Country |
valueOfAbbreviation(String abbr)
Gets the enum constant with the specified abbreviation.
|
static Country |
valueOfName(String name) |
static Country[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Country UnitedStates
private String name
private String abbreviation
public static Country[] values()
for (Country c : Country.values()) System.out.println(c);
public static Country valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic String getAbbreviation()
public static Country valueOfAbbreviation(String abbr)
abbr
- the state's abbreviation.