Skip to content

Instantly share code, notes, and snippets.

@ryanguest
Created August 6, 2013 22:09
Show Gist options
  • Save ryanguest/6169189 to your computer and use it in GitHub Desktop.
Save ryanguest/6169189 to your computer and use it in GitHub Desktop.
public class StateUtil {
Map<String,String> stateMap = new Map<String,String>();
public StateUtil(){
stateMap.put('Alabama','AL');
stateMap.put('Alaska','AK');
stateMap.put('Arizona','AZ');
stateMap.put('Arkansas','AR');
stateMap.put('California','CA');
stateMap.put('Colorado','CO');
stateMap.put('Connecticut','CT');
stateMap.put('Delaware','DE');
stateMap.put('Florida','FL');
stateMap.put('Georgia','GA');
stateMap.put('Hawaii','HI');
stateMap.put('Idaho','ID');
stateMap.put('Illinois','IL');
stateMap.put('Indiana','IN');
stateMap.put('Iowa','IA');
stateMap.put('Kansas','KS');
stateMap.put('Kentucky','KY');
stateMap.put('Louisiana','LA');
stateMap.put('Maine','ME');
stateMap.put('Maryland','MD');
stateMap.put('Massachusetts','MA');
stateMap.put('Michigan','MI');
stateMap.put('Minnesota','MN');
stateMap.put('Mississippi','MS');
stateMap.put('Missouri','MO');
stateMap.put('Montana','MT');
stateMap.put('Nebraska','NE');
stateMap.put('Nevada','NV');
stateMap.put('New Hampshire','NH');
stateMap.put('New Jersey','NJ');
stateMap.put('New Mexico','NM');
stateMap.put('New York','NY');
stateMap.put('North Carolina','NC');
stateMap.put('North Dakota','ND');
stateMap.put('Ohio','OH');
stateMap.put('Oklahoma','OK');
stateMap.put('Oregon','OR');
stateMap.put('Pennsylvania','PA');
stateMap.put('Rhode Island','RI');
stateMap.put('South Carolina','SC');
stateMap.put('South Dakota','SD');
stateMap.put('Tennessee','TN');
stateMap.put('Texas','TX');
stateMap.put('Utah','UT');
stateMap.put('Vermont','VT');
stateMap.put('Virginia','VA');
stateMap.put('Washington','WA');
stateMap.put('West Virginia','WV');
stateMap.put('Wisconsin','WI');
stateMap.put('Wyoming','WY');
}
public String getCode(String state) {
return stateMap.get(state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment