thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [jira] [Created] (THRIFT-4711) Improve Immutable None Type Instantiation
Date Tue, 01 Jan 2019 19:41:00 GMT
BELUGA BEHR created THRIFT-4711:

             Summary: Improve Immutable None Type Instantiation
                 Key: THRIFT-4711
             Project: Thrift
          Issue Type: Improvement
          Components: Java - Library
    Affects Versions: 0.12.0
            Reporter: BELUGA BEHR

    public static <T> Option<T> fromNullable(T value) {
        if (value != null) {
            return new Some<T>(value);
        } else {
            return new None<T>();

The {{None}} class is an immutable object, therefore it does not need to be instantiated for
every call to {{fromNullable}}.  Do the same thing as Java's {{Collections.emptyList()}} to
allow for a single static instance of {{None}} to return.

This message was sent by Atlassian JIRA

View raw message