Sdk (final WizardContext context) { if (context.getProject() == null) { List<Sdk> sdks = Arrays.asList(ProjectJdkTable.getInstance().getAllJdks()); ProjectBuilder builder = context.getProjectBuilder(); if (builder != null) { sdks = ContainerUtil.filter(sdks, sdk -> builder.isSuitableSdkType(sdk.getSdkType())); } Map<SdkTypeId, List<Sdk>> sdksByType = sdks.stream().collect(groupingBy(Sdk::getSdkType, mapping(Function.identity(), toList()))); Map.Entry<SdkTypeId, List<Sdk>> pair = ContainerUtil.getFirstItem(sdksByType.entrySet()); if (pair != null) { return pair.getValue().stream().max(pair.getKey().versionComparator()).orElse(null); } } return null; }