mercredi 16 mai 2018

Can you make this if statement smaller? CHALLENGE

I want to learn if you guys have better programming practices and I want to learn.

I want to check if the environmentName is the same as the containerName or it starts with WIP_, ADMIN_, CLIENT_, and then environmentName

Can you make this if smaller?

if (containerName.equals(environmentName) || containerName.equals("WIP_" + environmentName)
        || containerName.equals("ADMIN_" + environmentName)
        || containerName.equals("CLIENT_" + environmentName)) {

}

Aucun commentaire:

Enregistrer un commentaire