Choosing between ArrayList and LinkedList - JEP Cafe #20
How you can choose between ArrayList and LinkedList for your application: the full tutorial.
The Collections Framework offers two implementation for the List interface: ArrayList and LinkedList. How can you choose the best one for your application? This JEP Café shows you how you can bench each implementation, and the amount of memory they consume.
⎯⎯⎯⎯⎯⎯ Chapters ⎯⎯⎯⎯⎯⎯
0:00 Intro
0:57 Choosing the best implementation for your use case
1:53 Choosing the most common operations for benchmark
2:43 Can you apply the O(n) complexity to your use case?
5:00 Using JMH to run your benchmarks
6:25 Reading elements from the beginning and the end of a list
9:03 Reading elements from the middle of a list
11:01 Introducing pointer chasing
12:51 Benching the impact of pointer chasing on LinkedList
14:27 Iterating over a list with an index or an Iterator
16:48 Creating an array-based list to speed up your iterations
17:53 Wrapping up pointer chasing
18:20 ArrayList caveats: insertion, deletion, and resizing
20:01 Benching insertion and resizing for ArrayList
21:48 Comparing inserting and adding for ArrayList and LinkedList
23:25 Comparing the memory consumption of ArrayList and LinkedList
26:27 Reducing your memory footprint by using trimToSize()
28:08 Wrapping up performances and memory consumption
30:26 Outro
⎯⎯⎯⎯⎯⎯ Resources ⎯⎯⎯⎯⎯⎯
◦ JMH on GitHub, with doc and samples ➱
◦ Alexey Shipilev’s blog ➱
◦ Alexey Shipilev on JMH ➱
◦ Java Object Layout on GitHub, with doc and samples ➱
◦ Don Raab on Java Object Layout ➱
◦ ➱
◦ ➱
◦ JDK 21 ➱
◦ OpenJDK ➱
◦ Oracle Java ➱
Tags: #Java #Java21 #OpenJDK #JDK #JDK21 #Collection #JEPCafe #insidejava
2 views
985
277
2 weeks ago 00:03:12 14
Love and Deepspace | Where Drakeshadows Fall
3 weeks ago 00:04:49 1
Play To Earn🔥This New Play to Earn Game is About to Make a Lot of People RICH
2 months ago 00:01:18 5
Hippo Crushes Buck That’s Stuck in Mud After Wild Dogs Chased It!
2 months ago 00:26:23 1
Muslim LEARNS The DIFFERENCES Between HEAVEN in Islam & Christianity | Sam Shamoun
2 months ago 00:28:38 1
Why Countries Choose War Over Peace? Big Brains podcast with Chris Blattman
2 months ago 00:01:53 3
John Carpenter’s Toxic Commando - Reveal Trailer | Summer Game Fest 2023
2 months ago 00:19:52 1
Crochet Puff Flowers & How to Join As You Go - NO SEWING! 🌸
2 months ago 00:01:11 1
One Eleven Menerung Bangsar ||# Stan Wong 012 3755399
2 months ago 01:33:33 1
432 Hz Frequency for Plant Growth 🌱 Powerful Positive Music for Plants & Huamans
2 months ago 00:00:34 1
Isles of Scilly have built a ’safe space’ for Wally The Walrus - where he can be undisturbed | SWNS
2 months ago 00:03:23 1
Painting Flowers | Neku x Shiki [ neo twewy spoilers ]
2 months ago 00:04:44 1
Prepositions of Place Quiz (Beside - Under - Behind...)
2 months ago 00:14:31 1
PEREFCT HANDS IN FLUX 🔥 - One Master Workflow to Fix Hands, Enhance Face with switches !
2 months ago 00:03:15 2
Balance Breach - Come Undone (Official Music Video)
2 months ago 00:02:08 1
FAMILIES LIKE OURS | Official International Trailer | STUDIOCANAL
2 months ago 00:01:43 1
Pivot of Empire | Update 1.8 | Victoria 3
2 months ago 03:46:06 1
FULL GAME Miraculous Paris Under Siege Gameplay Walkthrough No Commentary Zag Heroez Miraculous
2 months ago 00:00:00 1
Joyrebel Smooth x Benjamin Stash - Dark Hour Mix
2 months ago 01:29:34 1
Top Food Hacks To Regenerate Stem Cells, Boost Brain Health & Improve Circulation | Dr. William Li
2 months ago 00:04:18 1
The Turing Protocol: A Thrilling AI Novel Chapter 7: The Crisis
2 months ago 00:01:32 1
Choose Your Dream Location: No Limits On Where You Can Live!