On Feb 12, 2015, at 3:50 PM, Daniel Fuchs <daniel.fu...@oracle.com> wrote:
> Hi Paul, > > This looks good - I have noticed one copy/paste error in the javadoc > though: > > OptionalInt.java: > > looks like the throws clause of ifPresent and ifPresentOrElse have been > interverted: > > 138 * @throws NullPointerException if a value is present and {@code > action} is > 139 * null, or a value is not present and {@code emptyAction} is null. > 140 */ > 141 public void ifPresent(IntConsumer action) { > 142 if (isPresent) { > 143 action.accept(value); > 144 } > 145 } > 146 > 147 /** > 148 * If a value is present, perform the given action with the value, > 149 * otherwise perform the given empty-based action. > 150 * > 151 * @param action the action to be performed if a value is present > 152 * @param emptyAction the empty-based action to be performed if a > value is > 153 * not present > 154 * @throws NullPointerException if value is present and {@code > action} is > 155 * null > 156 * @since 1.9 > 157 */ > 158 public void ifPresentOrElse(IntConsumer action, Runnable emptyAction) > { > Oops. Fixed. > > Concerning the test, should there be a test that verifies that NPE > is thrown when null is passed - as specified in the javadoc? > Done. http://cr.openjdk.java.net/~psandoz/jdk9/JDK-8071670-Optional-ifPresentOrElse/webrev/ Thanks, Paul.