Data Structures in Java Live Class 2019-03-26

A thorough look at the collection classes in java.util.** in Java

"No man ever steps in the same river twice, for it’s not the same river and he’s not the same man." Heraclitus, born 544 B.C.

Our live classes are different every time we run them. We do not promise to stick to the schedule, but will move as the students direct us. Some live classes are fantastic. Others just great. Your call.

Students Registered (50/50) - Sold Out

Please Email Us so we can inform you when the next class is scheduled.

This is a live virtual class running on March 26th, 2019 from 07:00-11:00 PDT, 10:00-14:00 EDT, 14:00-18:00 UTC, 19:30-23:30 IST.

Anyone registered will get access to the recording. In addition, they get access to the previous Data Structures Live Class Recording from the 21st February 2019, the Data Structures in Java and Build Your Own Circular Array List.

Java programmers typically use only very few collection classes for all of their work. Often they chose inappropriate ones. In this course, we will look at what each collection costs and when you should use which one. Some of the questions will we 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?

What you'll learn-and how you can apply it

  • Java has an overwhelming number of interfaces and classes in the java.util.** packages. In this course you will learn what they are and when to use which. Is ArrayList better than LinkedList? What is the difference in space complexity between the two classes?
  • 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.
  • By looking at hashing closely, we can learn how to write hashing functions that produce a 3x performance improvement for HashMap and ConcurrentHashMap.
  • We learn when to use which concurrent classes and which to avoid.

This training course is for you because...

  • Junior and intermediate Java programmers wanting to understand collections better.
  • Advanced programmers who want to acquire additional skills.


  • Attendees should be familiar with basic Java code, but a CS degree is not assumed
  • Should know at least Java 6. We are covering all relevant collection classes up until Java 11. Knowledge of streams and lambdas not necessary.

Recommended Follow-up

Sign up to The Java Specialists’ Newsletter for lots of tips on the latest Java developments: https://www.javaspecialists.eu/archive

"I enjoyed the data structures course, appreciate it not being a rehash of the self study course :)"

- Sudheendra Ayalasomayajula

This course is not open for enrollment.


The timeframes are only estimates and may vary according to how the class is progressing

0 - Welcome

(5m @07h00-07h05 5m)

  • Everything is in the recording
    • Heinz and his IDE
  • Quizzes
    • Answer in chat
  • Questions

1 - Introduction to Collections in Java

(10m @07h05-07h15 15m)

  • Computational Time and Space Complexity
    • O(1), O(n), O(n2), O(log n), O(n * log n)
  • Arrays
    • Primitive vs object arrays
    • Memory usage and layout
    • Multi-dimensional arrays


(5m @07h15-07h20 20m)

2 - Lists

(30m @07h20-07h50 50m)

  • Lists
    • Arrays.asList()
    • Quick look at the List methods
    • Optional methods
      • asList() vs List.of()
    • RandomAccess
  • ArrayList
    • Adding four seasons
    • indexOf() and contains()
    • size() vs elementData.length in debugger
    • removeIf()
  • Iteration
    • Enumeration bugs
    • Fail fast collection
    • forEach()
  • CopyOnWriteArrayList
    • Safe iteration
  • LinkedList
    • Node memory usage
    • Accessing middle of list


(5m @07h50-07h55 55m)

7 Minute Break

(7m @07h55-08h02)

3 - Sorting

(25m @08h02-08h27 25m)

  • Sorting lists
    • Sorting list of Strings
    • Sorting custom classes like Student
      • Comparing ints and longs
    • Writing Comparators as anonymous classes
    • Comparators with extractor functions
      • Type witnesses
      • Declared lambda parameters
      • Method references
    • Sorting performance ArrayList vs LinkedList
      • Parallel sorting of ArrayList


(5m @08h27-08h32 30m)

4 - Sets

(15m @08h32-08h47 45m)

  • Sets
    • Set.of()
    • union with addAll()
    • intersection with retainAll() or stream/filter
  • TreeSet
    • Sorted by natural order
    • Red-black tree
      • Unbalanced tree O(n) vs O(log n)
      • Counting maximum tree depth
  • ConcurrentSkipListSet
    • Thread-safe sorted set
  • CopyOnWriteArraySet
    • For very small sets


(5m @08h47-08h52 50m)

7 Minute Break

(7m @08h52-08h59)

5 - Hashing

(15m @08h59-09h14 15m)

  • Hashing
    • Writing very basic hashtable
    • Clashes and distribution
    • % vs &
  • HashSet
    • hashCode() vs identityHashCode()
    • Pixel and good hash code
    • Bucket collisions
    • Making keys implement Comparable
  • ConcurrentHashMap.newKeySet()


(5m @09h14-09h19 20m)

6 - Maps Part 1

(30m @09h19-09h49 50m)

  • Maps
    • one-to-one dictionary
  • 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

7 Minute Break

(7m @09h49-09h56)

"Today I attended a live webinar with Dr. Heinz Kabutz. Even though it was a 4 hour class which started quite early at my time zone, and about #datastructures in #Java - a topic with which I'm very familiar - I found it to be fun and informative.

... the interaction and ability to ask questions in real time was great (I may have asked too many questions lol).

I highly recommend his courses and webinars to anyone who's seeking to improve their #programming."

- Igal Sapir, Software Architect, Tomcat Committer, Lucee Committer

6 - Maps Part 2

(15m @09h56-10h11 15m)

  • ConcurrentHashMap
    • Always use
    • Compound operations review
  • TreeMap
    • hashCode(), equals() and compareTo()
    • Own Comparator
  • ConcurrentSkipListMap
    • Parallel put into TreeMap vs ConcurrentSkipListMap
  • LinkedHashMap and LinkedHashSet
  • Highly Specialized Collections: EnumSet, EnumMap, IdentityHashMap, Properties, WeakHashMap


(5m @10h11-10h16 20m)

7 - Queues and Deques

(10m @10h16-10h26 30m)

  • Queues and Deques
    • Not always FIFO
  • ConcurrentLinkedQueue and ConcurrentLinkedDeque
    • General purpose MPMC queues
    • size() is O(n)
  • ArrayDeque
    • Grows, does not shrink
  • BlockingQueues
  • LinkedBlockingQueue and LinkedBlockingDeque
    • Lock splitting
  • ArrayBlockingQueue
    • Compact array structure
  • Highly specialized queues: DelayQueue, SynchronousQueue, LinkedTransferQueue, PriorityQueue and PriorityBlockingQueue


(5m @10h26-10h31 50m)

4 Minute Break

(4m @10h31-10h35)

8 - Collection Facades

(10m @10h35-10h45 10m)

  • java.util.Collections
  • java.util.Arrays


(5m @10h45-10h50 15m)

9 - Wrap-up

(10m @10h50-11h00 25m)

Further questions


"For me it was a very interesting revisit to data structures. It is very educational to follow along and hear your comments as you code. Interesting to learn about alternate syntaxes etc , not always obvious to me :-), but that's the objective of the webinars to show new or advanced ways of coding."

- Ola Andersson

Course Curriculum

  Data Structures in Java Live Class
Available in days
days after you enroll

Courses Included with Purchase

Build Your Own CircularArrayList In Under 34 Minutes
See how we can create our own CircularArrayList by reusing the Collection framework abstract base classes.
Dr Heinz M. Kabutz
Data Structures in Java
A thorough look at the collection classes in java.util.** in Java
Dr Heinz M. Kabutz

Original Price: $267

This course is not open for enrollment.

Your Instructor

Dr Heinz M. Kabutz
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.

Frequently Asked Questions

How long do I have access to a fully paid course?
How does lifetime access sound? After enrolling, you have unlimited access to this course for as long as you like - across any and all devices you own. Furthermore, if we move to another platform, we will offer you a free transfer of your account for all the courses that you have purchased.
What is the difference between a subscription, paying in installments and an outright purchase?
With a subscription, you never own the rights to the material. If your card is declined or you cancel your subscription, you lose access to the course. The money you have paid so far is lost. Paying in installments is a bit better. You pay for 5 or 10 months and then once you have completed your installments you have lifetime access to the course. The safest is an outright purchase, where you pay the entire course in one amount. There is no risk of losing access.
Can I pay via PayPal?
Yes, you can for outright purchases, but not for recurring payments such as paying by installments or subscriptions.
Can I get an EU VAT Invoice?
Absolutely. First off, be sure to enter the VAT number in the appropriate field during the payment process. Then contact us for an EU VAT Invoice. Please tell us the receipt number for which you need the invoice.
May I share my login details with my colleagues?
Unfortunately not. The terms of usage are for a single license. Teachable tracks your progress through the curriculum, so you won't know how much you have watched. We offer a 50% discount on 15 licenses or more by one company. Please contact us for bulk licensing.
May we use the course for running in-house courses?
You may, as long as each of the students in the class has a valid license for that course. For example, a lot of companies run lunch time Design Patterns study groups using our material. This is an effective way to learn. Please contact us for bulk licensing.
What if I am unhappy with the course?
We would never want you to be unhappy! If you are unsatisfied with your purchase, contact us in the first 30 days and we will give you a full refund and deregister you from the course.
When does the course start and finish?
The course starts now and never ends! It is a completely self-paced online course - you decide when you start and when you finish. We do recommend putting time aside and setting goals to complete the course.
Can I watch the course offline during my commute?
Teachable have an iOS app that lets you watch offline. Android is not supported unfortunately.