Java has an overwhelming number of interfaces and classes in the java.util.** packages. It comes equipped with Collection, Map, List, Queue, Deque, BlockingQueue, Iterator and Iterable. And those are just some of the interfaces. We have a bunch of abstract classes, plus the implementations that we all know and love: HashMap and ArrayList
Purchase Dr Heinz M. Kabutz – JGym.IO Live – Data Structures in Java – 9-10 February 2021 courses at here with PRICE $497 $92
Dr Heinz M. Kabutz – JGym.IO Live – Data Structures in Java – 9-10 February 2021
Java has an overwhelming number of interfaces and classes in the java.util.** packages. It comes equipped with Collection, Map, List, Queue, Deque, BlockingQueue, Iterator and Iterable. And those are just some of the interfaces. We have a bunch of abstract classes, plus the implementations that we all know and love: HashMap and ArrayList. Java programmers typically use only a small number of these collection classes. Often they choose inappropriate ones.
In this course, we explore all the interfaces and classes that Java offers in the latest JDK collection framework. We will look at what each collection costs in terms of memory and performance. At the end, you will have a much better idea of what collections to use and when. You will also know how to write your own collections. This course is also available for self-study or as a booked in-house course.
Some of the questions we will answer include: Which is the best Collection to use in Java? When do you need to employ ConcurrentSkipListSet? What is the computational time complexity of WeakHashMap?
This course includes two live sessions of 4 hours each on the 9th and 10th of February 2021 with Dr Heinz M. Kabutz. Each data structure has exercises to solve. Heinz shows model solutions and is always happy to answer your questions.
What you’ll learn – and how you can apply it
- Is ArrayList better than LinkedList? What is the difference in space complexity between the two classes?
- When should we use LinkedList vs ArrayList vs CopyOnWriteArrayList?
- The memory footprint of various collections.
- By looking at hashing closely, we can learn how to spot bad hashes.
- We speed up hashing by 3x by using a good hash for HashMap and ConcurrentHashMap.
- We learn when to use which concurrent classes and which to avoid.
- Good techniques for measuring costs of collections.
- Computational time complexity of lookups and other operations.
- How biased locking affects our collection choices from Java 15 onwards.
- Why do we have UnsupportedOperationException.
- How ConcurrentModificationException came about and what to do about it.
- Choosing the correct collection can make our code more succinct. For example, the new List.of() syntax in Java 9 is better at creating immutable lists.
- Converting Maps to Sets.
- Compound operations on Maps.
- WeakHashMap, LinkedHashMap, LinkedHashSet, IdentityHashSet, ConcurrentSkipListSet and other collections we hardly use.
How do these LIVE classes work?
Our LIVE classes consist of two 4-hour sessions. They are highly interactive, with exercises, discussions, and walkthroughs of the solutions. Sessions are not recorded. We welcome questions at any time during the live session.
Each 4-hour session runs from 7am to 11am Los Angeles Time.
Once you enrol in this course, we will sign you up for the webinar. Our system will send you login details. These are personal to you so please do not share them (otherwise you might lose access to the course).
LIVE Class Calendar
Course Outline
0: Welcome
- Welcome to the course and how to get the most from your learning
1: Introduction to Collections in Java
1.1: Lists
- O(1), O(n), O(n2), O(log n), O(n * log n)
1.2: Arrays
- Primitive vs object arrays
- Memory usage and layout
- Multi-dimensional arrays
2: Lists
2.1: Lists
- Arrays.asList()
- Quick look at the List methods
- Optional methods
- asList() vs List.of()
- RandomAccess
2.2: ArrayList
- Adding four seasons
- indexOf() and contains()
- size() vs elementData.length in debugger
- removeIf()
2.3: Iteration
- Enumeration bugs
- Fail fast collection
- forEach()
2.4: CopyOnWriteArrayList
- Safe iteration
2.5: LinkedList
- Node memory usage
- Accessing middle of list
3: Sorting
3.1: Sorting list of Strings
3.2: Sorting custom classes like Student
- Comparing ints and longs
- Writing Comparators as anonymous classes
3.3: Comparators with extractor functions
- Type witnesses
- Declared lambda parameters
- Method references
3.4: Sorting performance ArrayList vs LinkedList
- Parallel sorting of ArrayList
4: Sets
4.1: Sets
- Set.of()
- union with addAll()
- intersection with retainAll() or stream/filter
4.2: TreeSet
- Sorted by natural order
- Red-black tree
- Unbalanced tree O(n) vs O(log n)
- Counting maximum tree depth
4.3: ConcurrentSkipListSet
- Thread-safe sorted set
4.4: CopyOnWriteArraySet
- For very small sets
5: Hashing
5.1: Hashing
- Writing very basic hashtable
- Clashes and distribution
- % vs &
5.2: HashSet
- hashCode() vs identityHashCode()
- Pixel and good hash code
- Bucket collisions
- Making keys implement Comparable
5.3: ConcurrentHashMap.newKeySet()
6: Maps
6.1: Maps
- one-to-one dictionary
6.2: HashMap
- History of hashing 1.2, 1.4, 1.8+
- Building a hash code with bit shifting Person(name,day,month,year)
- Cached hash code in Strings
- MapClashInspector
- Creating maps of numbers
- computeIfAbsent() for List of values
6.3: ConcurrentHashMap
- Always use
- Compound operations review
6.4: TreeMap
- hashCode(), equals() and compareTo()
- Own Comparator
6.5: ConcurrentSkipListMap
- Parallel put into TreeMap vs ConcurrentSkipListMap
6.6: LinkedHashMap and LinkedHashSet
6.7: Highly Specialized Collections
- EnumSet, EnumMap, IdentityHashMap, Properties, WeakHashMap
7: Queues and Deques
7.1: Queues and Deques
- Not always FIFO
7.2: ConcurrentLinkedQueue and ConcurrentLinkedDeque
- General purpose MPMC queues
- size() is O(n)
7.3: ArrayDeque
- Grows, does not shrink
7.4: BlockingQueues
7.5: LinkedBlockingQueue and LinkedBlockingDeque
- Lock splitting
7.6: ArrayBlockingQueue
- Compact array structure
7.7: Highly specialized queues
- DelayQueue, SynchronousQueue, LinkedTransferQueue, PriorityQueue and PriorityBlockingQueue
8: Collection Facades
- java.util.Collections
- java.util.Arrays
9: Wrap-Up
- Course wrap-up and next steps
Preparation
- This training is aimed at junior to intermediate Java programmers wanting to learn what Java data structures are available and how to best use them.
- Students should download and install the exercises found in the Resources chapter of the course material
Recommended Reading
- Sign up to The Java Specialists’ Newsletter for lots of tips on the latest Java developments: https://www.javaspecialists.eu/archive
Your Instructor
Dr Heinz M. Kabutz
Heinz Kabutz is the author of The Java Specialists’ Newsletter, a publication enjoyed by tens of thousands of Java experts in over 145 countries. His book “Dynamic Proxies (in German)” was #1 Bestseller on Amazon.de in Fachbücher für Informatik for about five minutes until Amazon fixed their algorithm. Thanks to a supportive mother, he has now sold 5 copies.
Heinz’s Java Specialists’ newsletter is filled with amusing anecdotes of life on the Island of Crete. He is a popular speaker at all the best Java conferences around the world, and also at some of the worst. He teaches Java courses in classrooms around the world, where his prime objective is to make absolutely sure that none of his students fall asleep. He is not always successful.
Purchase Dr Heinz M. Kabutz – JGym.IO Live – Data Structures in Java – 9-10 February 2021 courses at here with PRICE $497 $92
Reviews
There are no reviews yet.