Skip to content

Contains code samples and explanations of different Java Collections that every software engineer should know.

License

Notifications You must be signed in to change notification settings

Dimi7ri/JDK-collections

Repository files navigation

JDK-collections

This repository covers some of the most used collections of the JDK and their features.

Summary:

Collection class Base class Interfaces Duplicates Ordered Sorted Thread-safe
ArrayList AbstractListAbstractList List Yes Yes No No
LinkedList AbstractSequentialList List;Deque Yes Yes No No
Vector AbstractList List Yes Yes No Yes
HashSet AbstractSet Set No No No No
LinkedHashSet HashSet Set No Yes No No
TreeSet AbstractSet Set;NavigableSet; SortedSet No Yes Yes No
HashMap<K, V> AbstractMap<K, V> Map No No No No
LinkedHashMap<K, V> HashMap<K, V> Map No Yes No No
Hashtable<K, V> Dictionary<K, V> Map No No No Yes
TreeMap<K, V> AbstractMap<K, V> Map;NavigableMap; SortedMap No Yes Yes No

##
ArrayList
Implementation explaining .add() .get() .remove() .clear() .size() .next() and iteration using Iterator foreach and for.

##
LinkedList
Implementation explaining .add() .addFirst() .addLast() .get() .remove() .removeFirst() .removeLast(). .clear() .isEmpty() .size() .next() and Iteration using Iterator foreach and for.

##
ArrayList.vs.LinkedList
Execution time comparison between ArrayLists And LinkedLists, performing .add(); .get(); .remove();

##
HashMap
Implementation explaining .put() .get() .getKey() .getValue() .removeIf() .clear() .size() and iteration using Iterator and foreach.

##
LinkedHashMap
Impelementation explaining .put() .getKey() .getValue() .removeIf() .clear() .size() and iteration using Iterator and foreach.

##
Hashtable
Implementation explaining .put() .get() .getKey() .getValue() .clone() .clear() .size() and iteration using Iterator and foreach, Enumeration to display keys .keys() method.

##
TreeMap
Impelementation explaining .put() .entrySet() .getKey() .getValue() .size(), iteration using Iterator.

##
HashSet
Implementation explaining .add() .clear() .size() contains() methods and iteration using Iterator and foreach.

##
LinkedHashSet
Implementation explaining .add() .clear() .size() .isEmpy() methods and iteration using Iterator and foreach.

##
TreeSet
Implementation explaining .add() .first() .last() .ceiling(e) .floor(e) .pollFirst() .pollLast() .tailSet(e) .subSet(eFrom , eTo) .higher(e) .lower(e) .clear() .contains() methods and iteration using Iterator and foreach.

About

Contains code samples and explanations of different Java Collections that every software engineer should know.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages