Running on Java 16-ea+15-631 (Preview)
Home of The JavaSpecialists' Newsletter

Data Structures in Java Course

Become a master of the full set of data structures in the Java Development Kit

Java comes equipped with Collection, Map, List, Queue, Deque, BlockingQueue, Deque, 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.

In this one-day course, we explore all the interfaces and classes that Java offers in the latest JDK collection framework. At the end, you will have a much better idea of what collections to use when. You will also know how to write your own collections.

Here are some of the many things we will cover during this workshop:

  • Memory footprint of various collections
  • Computational time complexity of lookups and other operations
  • When to use LinkedList vs ArrayList vs CopyOnWriteArrayList
  • How HashMap behaves with bad keys
  • Speeding up hashing by 3x for modern Java versions
  • How biased locking affects our collection choices from Java 15 onwards
  • UnsupportedOperationException
  • How ConcurrentModificationException came about and what to do about it
  • Good techniques for measuring costs of collections
  • Converting Maps to Sets
  • Compound operations on Maps
  • WeakHashMap, LinkedHashMap, LinkedHashSet, IdentityHashSet, ConcurrentSkipListSet and other collections we hardly use.

Course Format

Most of our courses give students a lot of exercises. This course is different. We have an outline of what we want to cover, but then it is the author of the course demonstrating the various data structures and the students able to ask questions. There are no "slides" as such, everything is in code. At the end of the course, you will get a complete source repository of all the examples that we coded during class. Even though there are no exercises, students are encouraged to follow along in their IDE and try out the ideas that the instructor is demonstrating.

Who should take this course?

This course is aimed at junior to intermediate Java programmers wanting to learn what Java data structures are available and how to best use them.

General Enquiry


Read our Privacy Policy

Prerequisites

This course is aimed at junior to intermediate Java programmers wanting to learn what Java data structures are available and how to best use them.

Pricing Options

There are several options for you to attend this course:

1. In-house Course:

Presented at your company in-person by one of our Certified JavaSpecialist Instructors. Price is €3200 for up to 10 students, above that is an additional €300 per student, plus the travel expenses of the instructor, plus one teaching assistant. Please contact us if you have any questions.

Note: Due to the current COVID-19 pandemic, in person training is currently unavailable. Please choose Remote Instructor-Led Course instead.

2. Remote Instructor-Led Course:

Presented via video conference to your team of programmers by the author of the course. Price is €2976 for up to 10 students, above that is an additional €270 per student. Because of the extreme circumstances of COVID-19, we are also offering classes for six or more students. These are priced at €2300 for the first 6 students, thereafter an additional €283 per student. These prices are guaranteed until the 31st of May 2021.

Please contact us if you have any questions.

3. Self-Study:

Please see our self-study option for more information.

* Price is excluding EU VAT and withholding taxes where applicable. Please contact us for an exact quote for your country.

Open Courses

Location Dates Presenter Language Fees

* Price is excluding EU VAT where applicable. Please contact us for an exact quote for your country.

Detailed Outline

The emphasis of this training workshop is to learn what data structures modern Java has to offer. Here is our outline:

Schedule

  • 0. Welcome
  • 1. Introduction to Collections in Java
    • 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
  • 2. Lists
    • 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
  • 3. Sorting
    • 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
  • 4. Sets
    • 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
  • 5. Hashing
    • 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()
  • 6. Maps
    • 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
    • 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
  • 7 - Queues and Deques
    • 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
  • 8 - Collection Facades
    • java.util.Collections
    • java.util.Arrays
  • 9 - Wrap-up

About the Author

Heinz Kabutz Java Conference Speaker

Java Champion, author of the Javaspecialists Newsletter, conference speaking regular... About Heinz

Superpack 2020

Superpack 2020 Our entire Java Specialists Training in one huge bundle more...

Free Java Book

Dynamic Proxies in Java Book

110% Money-back Guarantee

Should you not be satisfied with the quality of the training or the delivery, we will gladly refund you 100% of the course fees. This needs to be brought to our attention within the first 4 hours of the course and a chance should be given to correct whatever you are not satisfied with. If you are still not satisfied, we will refund you 100% of the course fees, plus we will pay our own travel expenses. The training material then remains the property of JavaSpecialists.EU.


Cancellation Policy

If the course is cancelled more than two weeks before the start of the course, a 10% cancellation fee of the fees will apply, plus any non-refundable travel expenses incurred by the trainer.

If the course is cancelled within two weeks of the start of the course, a 50% cancellation fee of the fees will apply, plus any non-refundable travel expenses incurred by the trainer.

No refund will be given to cancellations during the course.


Java Training

We deliver relevant courses, by top Java developers to produce more resourceful and efficient programmers within their organisations.

Java Consulting

We can help make your Java application run faster and trouble-shoot concurrency and performance bugs...

Java Emergency?

If your system is down, we will review it for 15 minutes and give you our findings for just 1 € without any obligation.