public static <T> T flattenOption(scala.Option<T> option) {
        if (option.isEmpty()) {
            return null;
        } else {
            return option.get();
        }
    }
public static < T > T flattenOption ( scala . Option < T > option ) { if ( option . isEmpty ( ) ) { return null ; } else { return option . get ( ) ; } }
Flattens an option into its value or else null, which is not great but is usually more convenient in Java.
@param option Optional value -- either Some(T) or None
@param <T> Any type
@return The value inside the option, or else null