Hi guys,
I'm new in this list and I would like to contribute to Apache commons.
First of all I would like get some feedback if it makes sense to contribute.

Java is slow in implementation of null-safe operator however sometimes it's
really needed. So far I didn't find any implementation of this in any
library and I think it can be useful for many developers.

To the point, instead of writing something like:
    if(object != null
        && object.getProperty() != null
        && object.getProperty().getSubProperty()  != null
        && object.getProperty().getSubProperty().getSubSubProperty() !=
null  ){
      Object value =
object.getProperty().getSubProperty().getSubSubProperty().getSubSubSubProperty();
    }

I would like to turn it into something like this:
    Object value = ObjectUtils
        .nullish(object)
        .nullish(object::getProperty)
        .nullish(Property::getSubProperty)
        .nullish(SubProperty::getSubSubProperty)
        .get(SubSubProperty::getSubSubSubProperty);

The idea is to return null in the case any property 'on the way' returns
null. I can implement it with defaults as well.

Do you have some objections to the implementation? Do you know if it
already exists somewhere?

Thanks for your feedback,
best, Juraj+

Reply via email to