Truncate a LinkedList

Stephen Colebourne scolebourne at joda.org
Tue Feb 19 12:58:27 UTC 2013


On 19 February 2013 10:27, Weijun Wang <weijun.wang at oracle.com> wrote:
> I'm using LinkedList to maintain a history

Don't use LinkedList. Multiple benchmarks down the years have shown it
is almost always worse than ArrayList.

Stephen


> and the elements are ordered by
> their timestamps. Every now and then I would "expunge" the list, that is to
> say, iterating through the list and when an element is old enough all
> elements after (and including) it will be removed. Currently I'm removing
> them one by one.
>
> Is there a way to truncate the list using a single method?
>
> Thanks
> Max



More information about the core-libs-dev mailing list