vigna / fastutil

fastutil extends the Java™ Collections Framework by providing type-specific maps, sets, lists and queues.
Apache License 2.0
1.76k stars 196 forks source link

Replace KEY_CLASS_Reference with KEYS_USE_REFERENCE_EQUALITY #227

Closed techsy730 closed 3 years ago

techsy730 commented 3 years ago

This is much clearer that we mean the types that use == for equality testing instead of .equals, and not confuse it with the KEYS_REFERENCE macro which means any types using Object backed members.

Also documents the gotcha of trying to use a Reference based and a non-Reference based collection together (e.g. you may get non symmetric equals)

Also does the same for VALUE.

vigna commented 3 years ago

This is a very good idea. I always find myself trying to remember the difference between KEY_CLASS_Object and KEY_CLASS_Reference. This is so much better.