List Implementations ArrayList LinkedList
List Interface
Ordered collections allowing duplicates and nulls.
List Examples
ListarrayList = new ArrayList<>(); List linkedList = new LinkedList<>(); arrayList.add("Java"); arrayList.add("Python"); arrayList.remove(0); // Removes first element arrayList.get(0); // Access by index
Key Points
- ArrayList: fast random access, slow insertion/deletion.
- LinkedList: fast insertion/deletion, slow random access.
- Enhanced for-each:
for(String s : list). - Iterator for safe removal during iteration.