Last active
November 27, 2018 14:28
-
-
Save alexruzenhack/03fac2587cd656cfb29f881364afae36 to your computer and use it in GitHub Desktop.
📙 This #enum implements static functions in enum to get self values, and a list of parameters.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Status { | |
P("Pending"), | |
A("Approved"); | |
private String name; | |
Status(String name) { | |
this.name = name; | |
} | |
public String nameStatus() { | |
return name; | |
} | |
public static List<Status> listStatus() { | |
List<Status> listStatus = new ArrayList<Status>(); | |
for (Status status : Status.values()) { | |
listStatus.add(status); | |
} | |
return listStatus; | |
} | |
public static List<String> listName() { | |
List<String> names = new ArrayList<String>(); | |
for (Status status : Status.values()) { | |
names.add(status.name()); | |
} | |
return names; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment