Which is better? array, ArrayList or List (in terms of performance and speed)

前端 未结 3 1396
南笙
南笙 2020-12-31 00:32

I require a fast speed in processing my page. The count of the values to be added will be dynamic.

Which one of the above is preferred? Support with a valid reason.<

3条回答
  •  温柔的废话
    2020-12-31 01:13

    List is always gonna be faster than an arrayList. List 's dont have to box the values that are added to them.

    ArrayList only "accept" objects, so that means that while you can add any object you want to the list, it will have to be boxed (implicitly by the CLR) and then it has to be unboxed again (explicitly by you) when you need the values.

    edit: here is a nice link

提交回复
热议问题