[sip-comm-dev] Re: svn commit: r7622 - trunk/src/net/java/sip/communicator/impl/neomedia/MediaServiceImpl.java

Lubomir Marinov lubo at sip-communicator.org
Fri Aug 20 13:59:18 CEST 2010


On Fri, Aug 20, 2010 at 12:27 PM,  <kpouer at dev.java.net> wrote:
> Used addAll() instead of a manual arrayCopy
>
> Modified: trunk/src/net/java/sip/communicator/impl/neomedia/MediaServiceImpl.java
>             screenList = new ArrayList<ScreenDevice>(screens.length);
> -            for (ScreenDevice screen : screens)
> -                screenList.add(screen);
> +            screenList.addAll(Arrays.asList(screens));

Matthieu, thank you for taking care of the details which've slipped by me!

I'd like to ask you about the advantages of the addAll change. Among
the obvious advantages are that the code is shorter (thus more
readable) and the functions used describe the intention more directly
(thus even more readable). Apart from any other advantages you've
seen, I'm also interested whether the addAll approach in this very
case is also more efficient in terms of garbage/memory and/or speed.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at sip-communicator.dev.java.net
For additional commands, e-mail: dev-help at sip-communicator.dev.java.net





More information about the dev mailing list