collections
53 tutorials tagged “collections”.
- Difference Between Array and ArrayListArray vs ArrayList in Java: fixed vs dynamic size, primitives vs objects, length vs size(), performance, and when to use each, with examples.
- ArrayList Internal WorkingHow ArrayList works inside: the internal array, default capacity of 10, growth by 1.5 times, copying on resize, and the cost of add, get and remove.
- Difference Between ArrayList and LinkedListArrayList vs LinkedList in Java: internal structure, speed of get, add and remove, memory use, and how to choose, with a timing example.
- Difference Between ArrayList and VectorArrayList vs Vector in Java: synchronization, performance, growth rate, legacy methods and iteration. Learn the differences and which one to use.
- Arrays.asList vs List.ofArrays.asList and List.of both create lists quickly, but differ in mutability, null support and their link to the array. Learn every difference with examples.
- Choosing the Right CollectionA step-by-step guide to picking the right Java collection: list, set, map, queue or deque, and which class, based on order, duplicates, lookups and threads.
- Collection Interface in JavaThe Collection interface is the root interface for lists, sets and queues. Learn its common methods, such as add, remove, contains, size and removeIf.
- Collections Class in JavaThe Collections class holds static helpers for collections: sort, reverse, shuffle, max, min, frequency, binarySearch and read-only or synchronized wrappers.
- Time Complexity of Collection OperationsBig O costs of add, get, remove and contains for ArrayList, LinkedList, HashSet, TreeSet, HashMap, TreeMap, PriorityQueue and ArrayDeque in one place.
- Comparable Interface in JavaThe Comparable interface gives a class its natural sorting order through compareTo. Learn its rules, examples and how sort and TreeSet use it.