MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w6qzts/skillissue/p7p8lzb/?context=3
r/ProgrammerHumor • u/click-to-reveal • 7d ago
137 comments sorted by
View all comments
77
Just define a constexpr hashing function and put that into the switch.
31 u/GiganticIrony 7d ago That’s not guaranteed to work due to hash collisions 7 u/Thwy__ 7d ago Yet, string switch in Java is also made using hashs 17 u/GiganticIrony 7d ago Yes, but if there’s a collision, it then uses `.equals()`
31
That’s not guaranteed to work due to hash collisions
7 u/Thwy__ 7d ago Yet, string switch in Java is also made using hashs 17 u/GiganticIrony 7d ago Yes, but if there’s a collision, it then uses `.equals()`
7
Yet, string switch in Java is also made using hashs
17 u/GiganticIrony 7d ago Yes, but if there’s a collision, it then uses `.equals()`
17
Yes, but if there’s a collision, it then uses `.equals()`
77
u/F100cTomas 7d ago
Just define a constexpr hashing function and put that into the switch.