[ https://issues.apache.org/jira/browse/THRIFT-4711?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
James E. King III resolved THRIFT-4711. --------------------------------------- Resolution: Fixed Assignee: James E. King III Fix Version/s: 1.0 > Improve Immutable None Type Instantiation > ----------------------------------------- > > Key: THRIFT-4711 > URL: https://issues.apache.org/jira/browse/THRIFT-4711 > Project: Thrift > Issue Type: Improvement > Components: Java - Library > Affects Versions: 0.12.0 > Reporter: BELUGA BEHR > Assignee: James E. King III > Priority: Minor > Fix For: 1.0 > > Time Spent: 20m > Remaining Estimate: 0h > > {code:title=Option.java} > public static <T> Option<T> fromNullable(T value) { > if (value != null) { > return new Some<T>(value); > } else { > return new None<T>(); > } > } > {code} > 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. > https://github.com/openjdk-mirror/jdk7u-jdk/blob/master/src/share/classes/java/util/Collections.java#L3178-L3180 -- This message was sent by Atlassian JIRA (v7.6.3#76005)