EnumSet from VarArgs
Irritating that EnumSet doesn't support Varargs and/or iterable. That means you need some ugly transition code like:
public InclusionCompletionModel(JobStatus... completeStatuses) {
this.completeStatuses = EnumSet.copyOf( Arrays.asList( completeStatuses ) );
}
2 comments:
Sure it does.
How about:
if (completeStatuses.length > 0) {
this.completeStatuses = EnumSet.of(completeStatuses[0], completeStatuses);
} else {
this.completeStatuses = EnumSet.noneOf(InclusionCompletionModel.class);
}
Aren't you just proving my point about ugly transitional code? :)
Post a Comment