何时在 ArrayList 或 LinkedList 上使用 GlueList? [英] When to use GlueList over ArrayList or LinkedList?
问题描述
我遇到了名为 GlueList
我想知道什么时候应该使用 ArrayList 或 LinkedList.
I want to know when i should use over ArrayList or LinkedList.
推荐答案
老实说,如果您在阅读 GlueList 用几句话说明为什么它更好(不同),甚至有基准来查看真实值和 Big-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.
我是否需要经常在数组中间添加/删除项目?使用链表
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.
这篇关于何时在 ArrayList 或 LinkedList 上使用 GlueList?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!