On 07/12/2017 05:04, mandy chung wrote:


On 12/6/17 6:08 PM, Martin Buchholz wrote:
Google decided that LinkedList is almost never the best choice, so any use of LinkedList is discouraged.

ArrayDeque's backing array never shrinks, so you might want to give it an explicit initial size.


The initial size is 16 which is okay.  I can make it smaller instead:

-        static Deque<NativeLibrary> nativeLibraryContext = new LinkedList<>(); +        static Deque<NativeLibrary> nativeLibraryContext = new ArrayDeque<>(8);
This looks okay. It seems unlikely that hundreds of native libraries will be loaded, then unloaded, and the backing array being a memory concern.

-Alan

Reply via email to