-2

What does "(o==null ? a==null : o.equals(a))" mean in Java? I'm reading this from the "contains" method documentation of an ArrayList.

jsmith
  • 295
  • 1
  • 3
  • 9

1 Answers1

1

It's ternary comparison, and is equivalent to the following if statement:

if (o == null)
a == null;
else
o.equals(a);
Leaderboard
  • 371
  • 1
  • 10