In the same line of thought, once you've added equalsOr to String, why not Number, or any other type at that point? That becomes a lot of clutter in the API. I'm glad to see some java replacements for commonly used Apache StringUtils methods, but being selective about which ones to include seems wise.
I doubt allocating a small array of pointers is going to significantly impact your program. Heck, there's a good chance the JIT would optimize away the allocation.
1
u/syntastical Sep 19 '18
That works but I feel like it’s not any better than If(x.equals(y) || x.equals(z))
I really just want If(x.equalsOr(y, z))