How can I compare two values without using IF. I know it´s possible to use = ? or something like this. For instance, let´s compare the size of two arraylists c and t. For this, I would like to use a code similar to:
boolean answ = ? c.size() = t.size();
Try
boolean answ = c.size() == t.size();The ternary operator,
?, is used to get one of two answers—you don’t need it if you only need one boolean answer.