void (VersionView upperBoundView) { VersionView selectedAPIView = getSelectedAPIVersionView(); LanguageOrApiVersion selectedAPIVersion = selectedAPIView.getVersion(); LanguageOrApiVersion upperBound = upperBoundView.getVersion(); List<VersionView> permittedAPIVersions = new ArrayList<>(LanguageVersion.values().length + 1); if (isLessOrEqual(VersionView.LatestStable.INSTANCE.getVersion(), upperBound)) { permittedAPIVersions.add(VersionView.LatestStable.INSTANCE); } ArraysKt.mapNotNullTo( LanguageVersion.values(), permittedAPIVersions, languageVersion -> { ApiVersion apiVersion = ApiVersion.createByLanguageVersion(languageVersion); if (isLessOrEqual(apiVersion, upperBound) && !apiVersion.isUnsupported()) { return new VersionView.Specific(languageVersion); } return null; } ); apiVersionComboBox.setModel(new MutableCollectionComboBoxModel<>(permittedAPIVersions)); apiVersionComboBox.setSelectedItem( VersionComparatorUtil.compare(selectedAPIVersion.getVersionString(), upperBound.getVersionString()) <= 0 ? selectedAPIView : upperBoundView ); }