On Thu, 20 Apr 2023 13:33:17 GMT, Jan Lahoda <jlah...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 170: >> >>> 168: } else if (label instanceof EnumDesc<?> enumDesc) { >>> 169: if (target.getClass().isEnum() && >>> 170: ((Enum<?>) >>> target).describeConstable().stream().anyMatch(d -> d.equals(enumDesc))) { >> >> probably a matter of style but isn't it a bit too much to use streams here? >> there will be always only one element right? > > Technically, one element, but the type is optional, so formally could be no > elements. I could use `.get()`, but that feels a bit ugly and against > optional? yep I know, up to you I'm not strong on this, I guess I was thinking about performance but probably not using streams won't make a difference in this case ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1172609916