I rather like that. How about this (without “ds”)?
public File[] listRoots() {
return BitSet
.valueOf(new long[] {listRoots0()})
.stream()
.mapToObj(i -> new File((char)('A' + i) + ":" + slash))
.filter(f -> access(f.getPath()) && f.exists())
.toArray(File[]::new);
}
Thanks,
Brian
On Jun 27, 2017, at 10:54 PM, Tagir Valeev <[email protected]> wrote:
> 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.