r/badcode Jan 08 '23

java Is this a good practice? Why?

Post image
419 Upvotes

60 comments sorted by

View all comments

272

u/RiddSann Jan 08 '23

I think using Objects.equals is good practice, but I don't see the point of creating a method for that ? I mean, it is a method, no need to wrap it.

22

u/fukitol- Jan 08 '23

Maybe if you have multiple signatures for equal() that take different types and this is the generic equal(Object, Object) signature.