何时使用GlueList过的ArrayList或LinkedList的? [英] When to use GlueList over ArrayList or LinkedList?
问题描述
我遇到新的列表实现,要求来到 GlueList
I came across new list implementation which called GlueList
我想知道我什么时候应在使用ArrayList或者LinkedList的。
I want to know when i should use over ArrayList or LinkedList.
推荐答案
要说句实话,如果你不能在的 GlueList 的几句话为什么它是更好的(不同的),甚至有标杆看到真正的价值,也是大O符号其中规定 - 你是不是在位置,你要想想用有效尽可能名单。
To be honest, if you cant decide after reading info at GlueList which states in few sentences why it is better (different) and even have benchmark to see the real values and also Big-O notation - you are not in position where you have to think about use "as effective as possible" list.
如果你不知道干什么用的,这个规则是不够好:
If you are not sure what to use, this rule is good enough :
我需要往往是基于像阵列自己的位置来选择项目?然后使用ArrayList
Do I need to select items often based on their position like in array? Then use ArrayList.
我是否需要添加/删除经常在阵列的中间项?使用LinkedList的
Do I need add/remove items often in middle of array? Use LinkedList
PS:我没有使用LinkedList的很长一段时间,在多数正常情况下,ArrayList是更好的。
PS : I did not use LinkedList for a long time, in most "usual" cases the ArrayList is better.
这篇关于何时使用GlueList过的ArrayList或LinkedList的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!