Gary,
LANG-1634 [1] and PR 684 [2] opened for review.
Rob - yes exactly. I have found myself writing that utility method
multiple times, and almost all of those projects had commons-lang as a
dependency, so figured this would be a good place to have this
reusable piece of code.
Bindul
[1] https
applyIfNonNull looks to be a version of Optional without the Optional
object. The following is the same as suggested but with an additional
Optional object:
Optional.ofNullable(valueX).ifPresent(bean::setValue);
Optional.ofNullable(valueX).ifPresent(v -> someObject.compute(v,
"bar"));
Hi Bindul,
Let's see what this would look like with a PR :-)
Gary
On Mon, Dec 28, 2020, 01:23 Bindul Bhowmik wrote:
> Hi,
>
> I would like to propose an enhancement to the ObjectUtils class in lang:
>
> Background: I have seen multiple places in code where we have to check
> if a value is null
Hi,
I would like to propose an enhancement to the ObjectUtils class in lang:
Background: I have seen multiple places in code where we have to check
if a value is null before using it in a setter or other method, like:
if (valueX != null) {
bean.setValue(valueX);
someObject.com
WRT #firstNonNull, I don't know why I couldn't find it before. I do now,
and I agree it would seem to fit better in ArrayUtils.
Matt
On Mon, Jul 8, 2013 at 10:04 AM, Jörg Schaible
wrote:
> Hi Matt,
>
> Matt Benson wrote:
>
> > On Mon, Jul 8, 2013 at 8:22 AM, Jörg Schaible
> > wrote:
> >
> >> H
Hi Matt,
Matt Benson wrote:
> On Mon, Jul 8, 2013 at 8:22 AM, Jörg Schaible
> wrote:
>
>> Hi Hen,
>>
>> Henri Yandell wrote:
>>
>> > I don't see any value having the first two methods - replacing the '=='
>> > sign is a bit too far in the 'provide simple methods' direction I think
>> :)
>> >
>>
On Mon, Jul 8, 2013 at 8:22 AM, Jörg Schaible
wrote:
> Hi Hen,
>
> Henri Yandell wrote:
>
> > I don't see any value having the first two methods - replacing the '=='
> > sign is a bit too far in the 'provide simple methods' direction I think
> :)
> >
> > I think the third method is already in Lang
Hi Hen,
Henri Yandell wrote:
> I don't see any value having the first two methods - replacing the '=='
> sign is a bit too far in the 'provide simple methods' direction I think :)
>
> I think the third method is already in Lang as:
>
> ArrayUtils.contains(array, null);
Well, no, this is n
I don't see any value having the first two methods - replacing the '=='
sign is a bit too far in the 'provide simple methods' direction I think :)
I think the third method is already in Lang as:
ArrayUtils.contains(array, null);
Having a containsNull is semantically nice, but I'm not sure it
On 4 July 2013 19:43, Rafael Santini wrote:
> Hi,
>
> I would like to propose a method in ObjectUtils class that receives an array
> of objects and returns true if all objects are not null. I have implemented
> the following:
>
> public static boolean isNull(Object object) {
>return object ==
Benedikt Ritter wrote:
> You could do this with with CollectionsUtils from [Collections].
> But I think we all agree that implementing a Predicate inline is a lot
> more verbose than the proposed method.
+1
We have traditionally such convenience methods in lang.
When I look at the current argum
I second Ted. Do we really need this function at all? Just for the sake of
adding a piece of code should not run the purpose of adding an API
function.
On Fri, Jul 5, 2013 at 1:24 AM, Benedikt Ritter wrote:
> You could do this with with CollectionsUtils from [Collections].
> But I think we all
You could do this with with CollectionsUtils from [Collections].
But I think we all agree that implementing a Predicate inline is a lot more
verbose than the proposed method.
2013/7/4 Ted Dunning
> A bigger question is why this is needed at all.
>
> Why not just use composition? In guava, one
A bigger question is why this is needed at all.
Why not just use composition? In guava, one would do this:
Iterables.all(Arrays.asList(foo), new Predicate() {
@Override
public boolean apply(Double input) {
return input != null;
}
This implies that having arrays with some null elements is
a) somewhat common
2) a good idea
I'd say both are not true.
I'm not sure the library should promote that the above is the case.
On 07/04/2013 02:43 PM, Rafael Santini wrote:
Hi,
I would like to propose a method in ObjectUtils cla
Hi,
I would like to propose a method in ObjectUtils class that receives an array
of objects and returns true if all objects are not null. I have implemented
the following:
public static boolean isNull(Object object) {
return object == null;
}
public static boolean isNotNull(Object object)
16 matches
Mail list logo