JDK 13 RFR of JDK-8223178: Improve FileSystems.newFileSystem example with map factory methods

Langer, Christoph christoph.langer at sap.com
Wed May 1 13:10:49 UTC 2019


> -----Original Message-----
> From: core-libs-dev <core-libs-dev-bounces at openjdk.java.net> On Behalf
> Of Alan Bateman
> Sent: Mittwoch, 1. Mai 2019 08:17
> To: Joe Darcy <joe.darcy at oracle.com>; nio-dev <nio-
> dev at openjdk.java.net>
> Cc: core-libs-dev <core-libs-dev at openjdk.java.net>
> Subject: Re: JDK 13 RFR of JDK-8223178: Improve FileSystems.newFileSystem
> example with map factory methods
> 
> On 01/05/2019 02:59, Joe Darcy wrote:
> > :
> >
> > --- a/src/java.base/share/classes/java/nio/file/FileSystems.java Tue
> > Apr 30 16:11:42 2019 -0700
> > +++ b/src/java.base/share/classes/java/nio/file/FileSystems.java Tue
> > Apr 30 18:52:11 2019 -0700
> > @@ -252,10 +252,9 @@
> >       * Suppose there is a provider identified by the scheme {@code
> > "memory"}
> >       * installed:
> >       * <pre>
> > -     *   Map<String,String> env = new HashMap<>();
> > -     *   env.put("capacity", "16G");
> > -     *   env.put("blockSize", "4k");
> > -     *   FileSystem fs =
> > FileSystems.newFileSystem(URI.create("memory:///?name=logfs"), env);
> > +     *   FileSystem fs =
> > FileSystems.newFileSystem(URI.create("memory:///?name=logfs"),
> > + * Map.of("capacity", "16G",
> > + * "blockSize", "4k"));
> Changing it to use an unmodifable map is good. One nit the really long
> line in the source will be annoying with future side-by-side diffs. It
> wouldn't take much from the readability to keep env.

+1



More information about the nio-dev mailing list