looking for FAQ on interconversion of IntFoo and Foo<Integer>

John Rose john.r.rose at oracle.com
Tue Apr 16 00:01:45 PDT 2013

Where is the standard place to find the design discussion for primitive-type specializations of the new interfaces (functions, producers, consumers, optionals...)?

In particular, will users be able to ignore higher-order functions of unboxed values and later adjust code locally for efficiency?

If so, are there conversion operators that correspond to auto-box and auto-unbox of non-functional, which can be used to make adjustments at the boundaries?

Finally (and this is what prompted me to ask) why not make IntSupplier or OptionalInt be sub-interfaces of the reference-bearing ones, with autoboxing around the edges (see below)?

Since this is probably a rehash of past discussions, I'm looking to be pointed at some sort of Email thread or even (!) a wiki page.

— John

P.S. It looks like this sort of stuff was in the repo at first and then was yanked recently.

diff --git a/src/share/classes/java/util/function/IntSupplier.java b/src/share/classes/java/util/function/IntSupplier.java
--- a/src/share/classes/java/util/function/IntSupplier.java
+++ b/src/share/classes/java/util/function/IntSupplier.java
@@ -32,7 +32,12 @@
 * @since 1.8
-public interface IntSupplier {
+public interface IntSupplier
+    extends Supplier<Integer>
+    /** Returns the result of {@code getAsInt}, boxed. */
+    // in my dreams, this would allows IntSupplier to convert to Supplier<Integer>
+    public default Integer get() { return getAsInt(); }

     * Returns an {@code int} value.

More information about the lambda-dev mailing list