jeudi 28 octobre 2021

Multiple if condition in java " if value exists in a list " [duplicate]

Is there another alternative to do this in java instead of listing values one by one ?

if ( x.equals("a") || x.equals("b") || x.equals("c") || x.equals("d") || x.equals("e") ){}

for example x exists in this list (a,b,c,d,e)

Aucun commentaire:

Enregistrer un commentaire