How do I stream a Enum Value-Label into a List object? Two
public enum ProductActions {
BUY("Buy"),
SELL("Sell"),
Transfer("Transfer"),
public final String label;
ProductActions(String label) {
this.label = label;
}
}
Want to transfer into this List<ProductActionItem>
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProductActionItem {
private String productAction;
private String productLabel;
}
Working on Code:
return Arrays.stream(productActions.values())
.map(e -> e.label).collect(Collectors.toList());
Trying to use this Resource: