What is the difference between Lists, ArrayLists, Maps, Hashmaps, Collections etc..?

后端 未结 10 1751
-上瘾入骨i
-上瘾入骨i 2021-01-30 01:38

I\'ve been using HashMaps since I started programming again in Java without really understanding these Collections thing.

Honestly I am not really sure if using HashMaps

10条回答
  •  梦毁少年i
    2021-01-30 02:21

    As you already know, they are containers for objects. Reading their respective APIs will help you understand their differences.

    Since others have described what are their differences about their usage, I will point you to this link which describes complexity of various data structures.

    This list is programming language agnostic, and, as always, real world implementations will vary.

    It is useful to understand complexity of various operations for each of these structures, since in the real world, it will matter if you're constantly searching for an object in your 1,000,000 element linked list that's not sorted. Performance will not be optimal.

提交回复
热议问题