CredentialsType () { for (Map.Entry<CredentialsType, TypeHandler> type2handler : myCredentialsType2Handler.entrySet()) { if (type2handler.getValue().getRadioButton().isSelected()) { return type2handler.getKey(); } } throw new IllegalStateException(); }