void (CredentialsCase... cases) { Pair<Object, CredentialsType> credentialsAndType = getCredentialsAndType(); CredentialsType type = credentialsAndType.getSecond(); for (CredentialsCase credentialsCase : cases) { if (credentialsCase.getType() == type) { credentialsCase.process(credentialsAndType.getFirst()); return; } } }