JDK 10 RFR of 8182710: File.listRoots() always returns the root of CD drive

Tagir Valeev amaembo at gmail.com
Wed Jun 28 05:54:36 UTC 2017


Hello!

Just an alternative which looks more readable to me (no explicit bit
twiddling):
-        int ds = listRoots0();
-        return IntStream
-            .range(0, 26)
-            .filter(i -> ((ds >> i) & 1) != 0)
+       long[] ds = {listRoots0()};
+       return BitSet
+            .valueOf(ds)
+            .stream()

Probably a matter of taste though.

With best regards,
Tagir Valeev.

On Wed, Jun 28, 2017 at 2:05 AM, Brian Burkhalter <
brian.burkhalter at oracle.com> wrote:

> Hi Peter,
>
> On Jun 24, 2017, at 2:07 PM, Peter Levart <peter.levart at gmail.com> wrote:
>
> > This looks good, but since this is not a performance-critical method,
> why not use streams?
> >
> > For example:
> >
> >     […]
> >
> >
> > Isn't this nicer compared to:
>
> Indeed it is more appealing. Tested successfully and webrev updated
> accordingly at http://cr.openjdk.java.net/~bpb/8182710/webrev.01/.
>
> Thanks,
>
> Brian


More information about the core-libs-dev mailing list