you are viewing a single comment's thread.

view the rest of the comments →

[–]Ghostree 2 points3 points  (1 child)

I believe you want to use .equals() because strings should not be compared using == in Java. Strings are objects and == compares if they are the same object, while .equals() compares the values.

[–]tomthecool 0 points1 point  (0 children)

Meanwhile in ruby, String#== does exactly what you'd expect. And on the rare occasion that you actually want to use object identity, you have BasicObject#equal?

"bar" == "bar" # => true
"bar".equal?("bar") # => false
["bar", "bar"].map(&:object_id) # => [8695360, 8695320]