I have an enumeration called PaymentFrequency:
public enum PaymentFrequency {
D("Daily"),
W("Weekly"),
M("Monthly"),
Y("Yearly");
private final String description;
PaymentFrequency(final String description) {
this.description = description;
}
public String getDescription() {
return description;
}
}
And now if I do this in my bean:
private PaymentFrequency[] paymentPeriods = PaymentFrequency.values();
public PaymentFrequency[] getPaymentPeriods() {
return paymentPeriods;
}
public void setPaymentPeriods(PaymentFrequency[] paymentPeriods) {
this.paymentPeriods = paymentPeriods;
}
I will get all the values from my enumeration. How can I get only the values W and M ?
Well, you could do