Data Structures in Java Live Class 2019-03-26
A thorough look at the collection classes in java.util.** in Java
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.
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.
Sign up to The Java Specialists’ Newsletter for lots of tips on the latest Java developments: https://www.javaspecialists.eu/archive
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
- Answer in chat
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)
- Primitive vs object arrays
- Memory usage and layout
- Multi-dimensional arrays
(5m @07h15-07h20 20m)
2 - Lists
(30m @07h20-07h50 50m)
- Quick look at the List methods
- Optional methods
- asList() vs List.of()
- Adding four seasons
- indexOf() and contains()
- size() vs elementData.length in debugger
- Enumeration bugs
- Fail fast collection
- Safe iteration
- Node memory usage
- Accessing middle of list
(5m @07h50-07h55 55m)
7 Minute Break
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)
- union with addAll()
- intersection with retainAll() or stream/filter
- Sorted by natural order
- Red-black tree
- Unbalanced tree O(n) vs O(log n)
- Counting maximum tree depth
- Thread-safe sorted set
- For very small sets
(5m @08h47-08h52 50m)
7 Minute Break
5 - Hashing
(15m @08h59-09h14 15m)
- Writing very basic hashtable
- Clashes and distribution
- % vs &
- hashCode() vs identityHashCode()
- Pixel and good hash code
- Bucket collisions
- Making keys implement Comparable
(5m @09h14-09h19 20m)
6 - Maps Part 1
(30m @09h19-09h49 50m)
- one-to-one dictionary
- 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
- Creating maps of numbers
- computeIfAbsent() for List of values
7 Minute Break
"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)
- Always use
- Compound operations review
- hashCode(), equals() and compareTo()
- Own Comparator
- 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)
- Grows, does not shrink
- LinkedBlockingQueue and LinkedBlockingDeque
- Lock splitting
- Compact array structure
- Highly specialized queues: DelayQueue, SynchronousQueue, LinkedTransferQueue, PriorityQueue and PriorityBlockingQueue
(5m @10h26-10h31 50m)
4 Minute Break
8 - Collection Facades
(10m @10h35-10h45 10m)
(5m @10h45-10h50 15m)
9 - Wrap-up
(10m @10h50-11h00 25m)
"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."
Courses Included with Purchase
Original Price: $267
This course is not open for enrollment.
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.