isEmpty style methods on collections also let the implementation optimise the checking for empty case without having to access all the items in the possibly lazyly loaded collection.
________________________________
From: Alex Osborne [notifications@github.com]
Sent: Friday, July 12, 2013 1:57 AM
To: nla/doss
Subject: Re: [doss] Command-line cat command (née get) (#19)


In src/doss/Main.java:

> +
> +                final ByteBuffer buffer = ByteBuffer.allocateDirect(16 * 1024);
> +
> +                while (channel.read(buffer) != -1) {
> +                    buffer.flip();
> +                    dest.write(buffer);
> +                    buffer.compact();
> +                }
> +                buffer.flip();
> +                while (buffer.hasRemaining()) {
> +                    dest.write(buffer);
> +                }
> +            }
> +
> +            void execute(Arguments args) throws IOException {
> +                if (args.size() < 1) {


Use args.isEmpty() instead. Then we don't need to add Arguments#size() anymore. :-)

—
Reply to this email directly or view it on GitHub<https://github.com/nla/doss/pull/19/files#r5144404>.