Re: [lang] new method: ObjectsUtils.equalsOneOf()

2016-08-08 Thread thomas menzel
Hi Paul and Gary, thanks for the input. The use case, as stated, is to have a more readable *shorthand* when coding conditions and having the need to compare to an arbitrary list of values. I know the ArrayUtils and CollectionUtils and use it frequently, but i'd like to have as little

Re: [lang] new method: ObjectsUtils.equalsOneOf()

2016-08-08 Thread thomas menzel
Hi Stian, thx for ur +1 The rational behind equalsOneOf(null, null)== false, is that  a) all or most methods in this class with varargs==null result in false b) it also enforce the notion of the name, that i'm comparing against a "collection of values" and this collection is set up by me in

Re: [lang] new method: ObjectsUtils.equalsOneOf()

2016-08-06 Thread Stian Soiland-Reyes
+1 for the proposal! I think ObjectUtils is a good home, the implied array or collection is an implementation detail. What is your reasoning for null != null ? If you accept a Function to compare with, that would break the varargs mechanism (or always require a Function), perhaps such a

Re: [lang] new method: ObjectsUtils.equalsOneOf()

2016-08-06 Thread Gary Gregory
I think we should stick with the contains prefix. Gary On Aug 6, 2016 2:43 PM, "Paul Benedict" wrote: > Hi Thomas. The only issue I see with introducing a "equalsOneOf" is that it > setups the pondering for other uses... greater than one of, less than one > of, and

Re: [lang] new method: ObjectsUtils.equalsOneOf()

2016-08-06 Thread Paul Benedict
Hi Thomas. The only issue I see with introducing a "equalsOneOf" is that it setups the pondering for other uses... greater than one of, less than one of, and whatever of one of. With that said, I would rather see the proposed method accept a function/visitor callback to determine the check. If

[lang] new method: ObjectsUtils.equalsOneOf()

2016-08-06 Thread thomas menzel
Hi folks, I'm proposing a new function on ObjectsUtils: /** * Checks if the given {@code ref} is contained at least once in * {@code others}. If {@code} is null or empty then {@code false} is * returned. * * This is a more readable replacement for the