I want to simplify the given code (actually the mapping of status):
private static final Map<SomeStatusEnum, OtherStatusEnum> STATUS_ENUM_MAP = Map.of(
SomeStatusEnum.A, OtherStatusEnum.OK,
SomeStatusEnum.B, OtherStatusEnum.NOK,
SomeStatusEnum.C, OtherStatusEnum.NOK,
SomeStatusEnum.D, OtherStatusEnum.NOK,
SomeStatusEnum.E, OtherStatusEnum.NOK,
SomeStatusEnum.F, OtherStatusEnum.NOK
);
to a structure like:
private static final Map<SomeStatusEnum, OtherStatusEnum> STATUS_ENUM_MAP = Map.of(
SomeStatusEnum.A, OtherStatusEnum.OK,
*ALL OTHER SomeStatusEnums*, OtherStatusEnum.NOK
);
so that only SomeStatusEnum.A
points to OtherStatusEnum.OK
while all others point to OtherStatusEnum.NOK
without writing all of them in the map explicitly.
Anyone an idea?