Helper classes (original) (raw)

Stephen Colebourne scolebourne at joda.org
Mon Apr 15 01:53:00 PDT 2013


Currently, Project Lambda has a number of helper clases, notably Collectors and Streams, which are clearly related to the interface. Since JDK8 has static methods on interfaces, are there plans to move the static methods to the interface?

This would allow methods such as intBuilder(), emptyIntStream() and singletonIntStream(int t) to be on IntStream rather than on Stream, and thus have the simpler names of builder(), emptyStream(), singletonStream().

Making the change might also affect some method names, as sometimes they read differently, or are otherwise confusing, when on the interface.

As a note, on JSR-310, we did move the methods from similar static helper classes to the interfaces: http://hg.openjdk.java.net/jdk8/tl/jdk/file/f4d50e8cc9e2/src/share/classes/java/time/temporal/TemporalAdjuster.java http://hg.openjdk.java.net/jdk8/tl/jdk/file/f4d50e8cc9e2/src/share/classes/java/time/temporal/TemporalQuery.java although I'm not sure that counts as precedent yet.

Stephen



More information about the lambda-dev mailing list