Groovy allows me to say
x?.getY()
instead of the verbose
x == null ? null : x.getY().
Java does not allow custom operators, but I can imagine a utility method that's used like so:
safe(x).getY();
Is there any standard library in the world's Maven repos that does this kind of thing? If no, and I wanted to include it in an open source library (like apache.commons.lang), where would it best fit?
Edit: sample implementation of safe():
public static <T> T safe(T x) {
    if (x==null) {
        return new NullReturningMock<T>();
    } else {
        return x;
    }
}
 
    