Submit Search
Upload
How to build immutable data structures in Java
•
Download as PPTX, PDF
•
0 likes
•
265 views
AI-enhanced title
宇
宇 傅
Follow
Immutable Data Structures(不可变数据结构), advantages, and applications
Read less
Read more
Software
Report
Share
Report
Share
1 of 72
Download now
Recommended
Update on Raptor - understanding usage information for e-resources - Dr Rhys ...
Update on Raptor - understanding usage information for e-resources - Dr Rhys ...
Eduserv
The Cassandra Distributed Database
The Cassandra Distributed Database
Eric Evans
Redis: An introduction
Redis: An introduction
Đặng Thảo
Outside The Box With Apache Cassnadra
Outside The Box With Apache Cassnadra
Eric Evans
Ruby and Distributed Storage Systems
Ruby and Distributed Storage Systems
SATOSHI TAGOMORI
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
Intro to Big Data and NoSQL
Intro to Big Data and NoSQL
Don Demcsak
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
Recommended
Update on Raptor - understanding usage information for e-resources - Dr Rhys ...
Update on Raptor - understanding usage information for e-resources - Dr Rhys ...
Eduserv
The Cassandra Distributed Database
The Cassandra Distributed Database
Eric Evans
Redis: An introduction
Redis: An introduction
Đặng Thảo
Outside The Box With Apache Cassnadra
Outside The Box With Apache Cassnadra
Eric Evans
Ruby and Distributed Storage Systems
Ruby and Distributed Storage Systems
SATOSHI TAGOMORI
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL worst practices, version PGConf.US 2017 by Ilya Kosmodemiansky
PostgreSQL-Consulting
Intro to Big Data and NoSQL
Intro to Big Data and NoSQL
Don Demcsak
SQL Server 2014 Memory Optimised Tables - Advanced
SQL Server 2014 Memory Optimised Tables - Advanced
Tony Rogerson
Alluxio - Scalable Filesystem Metadata Services
Alluxio - Scalable Filesystem Metadata Services
Alluxio, Inc.
Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)
Don Demcsak
HBase in Practice
HBase in Practice
DataWorks Summit/Hadoop Summit
HBase in Practice
HBase in Practice
larsgeorge
Why databases cry at night
Why databases cry at night
Michael Yarichuk
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014
Haim Yadid
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
Evan Chan
What's new with Apache Tika?
What's new with Apache Tika?
gagravarr
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
Hakka Labs
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
P. Taylor Goetz
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
DataWorks Summit
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Speedment, Inc.
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Malin Weiss
Introduction to libre « fulltext » technology
Introduction to libre « fulltext » technology
Robert Viseur
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
Alluxio, Inc.
Rust All Hands Winter 2011
Rust All Hands Winter 2011
Patrick Walton
Search at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, Twitter
Lucidworks
Building Big Data Streaming Architectures
Building Big Data Streaming Architectures
David Martínez Rego
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Rahul Borate
Hbase schema design and sizing apache-con europe - nov 2012
Hbase schema design and sizing apache-con europe - nov 2012
Chris Huang
Parallel Query Execution
Parallel Query Execution
宇 傅
The Evolution of Data Systems
The Evolution of Data Systems
宇 傅
More Related Content
Similar to How to build immutable data structures in Java
Alluxio - Scalable Filesystem Metadata Services
Alluxio - Scalable Filesystem Metadata Services
Alluxio, Inc.
Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)
Don Demcsak
HBase in Practice
HBase in Practice
DataWorks Summit/Hadoop Summit
HBase in Practice
HBase in Practice
larsgeorge
Why databases cry at night
Why databases cry at night
Michael Yarichuk
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014
Haim Yadid
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
Evan Chan
What's new with Apache Tika?
What's new with Apache Tika?
gagravarr
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
Hakka Labs
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
P. Taylor Goetz
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
DataWorks Summit
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Speedment, Inc.
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Malin Weiss
Introduction to libre « fulltext » technology
Introduction to libre « fulltext » technology
Robert Viseur
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
Alluxio, Inc.
Rust All Hands Winter 2011
Rust All Hands Winter 2011
Patrick Walton
Search at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, Twitter
Lucidworks
Building Big Data Streaming Architectures
Building Big Data Streaming Architectures
David Martínez Rego
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Rahul Borate
Hbase schema design and sizing apache-con europe - nov 2012
Hbase schema design and sizing apache-con europe - nov 2012
Chris Huang
Similar to How to build immutable data structures in Java
(20)
Alluxio - Scalable Filesystem Metadata Services
Alluxio - Scalable Filesystem Metadata Services
Big Data (NJ SQL Server User Group)
Big Data (NJ SQL Server User Group)
HBase in Practice
HBase in Practice
HBase in Practice
HBase in Practice
Why databases cry at night
Why databases cry at night
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
FiloDB: Reactive, Real-Time, In-Memory Time Series at Scale
What's new with Apache Tika?
What's new with Apache Tika?
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
DataEngConf: Parquet at Datadog: Fast, Efficient, Portable Storage for Big Data
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
Large Scale Graph Analytics with JanusGraph
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
Introduction to libre « fulltext » technology
Introduction to libre « fulltext » technology
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
Rust All Hands Winter 2011
Rust All Hands Winter 2011
Search at Twitter: Presented by Michael Busch, Twitter
Search at Twitter: Presented by Michael Busch, Twitter
Building Big Data Streaming Architectures
Building Big Data Streaming Architectures
UNIT I Introduction to NoSQL.pptx
UNIT I Introduction to NoSQL.pptx
Hbase schema design and sizing apache-con europe - nov 2012
Hbase schema design and sizing apache-con europe - nov 2012
More from 宇 傅
Parallel Query Execution
Parallel Query Execution
宇 傅
The Evolution of Data Systems
The Evolution of Data Systems
宇 傅
The Volcano/Cascades Optimizer
The Volcano/Cascades Optimizer
宇 傅
PelotonDB - A self-driving database for hybrid workloads
PelotonDB - A self-driving database for hybrid workloads
宇 傅
The Case for Learned Index Structures
The Case for Learned Index Structures
宇 傅
Spark and Spark Streaming
Spark and Spark Streaming
宇 傅
Functional Programming in Java 8
Functional Programming in Java 8
宇 傅
第三届阿里中间件性能挑战赛冠军队伍答辩
第三届阿里中间件性能挑战赛冠军队伍答辩
宇 傅
Data Streaming Algorithms
Data Streaming Algorithms
宇 傅
Golang 101
Golang 101
宇 傅
Docker Container: isolation and security
Docker Container: isolation and security
宇 傅
Paxos and Raft Distributed Consensus Algorithm
Paxos and Raft Distributed Consensus Algorithm
宇 傅
More from 宇 傅
(12)
Parallel Query Execution
Parallel Query Execution
The Evolution of Data Systems
The Evolution of Data Systems
The Volcano/Cascades Optimizer
The Volcano/Cascades Optimizer
PelotonDB - A self-driving database for hybrid workloads
PelotonDB - A self-driving database for hybrid workloads
The Case for Learned Index Structures
The Case for Learned Index Structures
Spark and Spark Streaming
Spark and Spark Streaming
Functional Programming in Java 8
Functional Programming in Java 8
第三届阿里中间件性能挑战赛冠军队伍答辩
第三届阿里中间件性能挑战赛冠军队伍答辩
Data Streaming Algorithms
Data Streaming Algorithms
Golang 101
Golang 101
Docker Container: isolation and security
Docker Container: isolation and security
Paxos and Raft Distributed Consensus Algorithm
Paxos and Raft Distributed Consensus Algorithm
Recently uploaded
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
kaushalgiri8080
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
BradBedford3
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
Jhone kinadey
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Christina Lin
What is Binary Language? Computer Number Systems
What is Binary Language? Computer Number Systems
JheuzeDellosa
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
shikhaohhpro
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
stazi3110
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
MyIntelliSource, Inc.
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Andolasoft Inc
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
aagamshah0812
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
ICS
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
kalichargn70th171
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
kellynguyen01
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
Arshad QA
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
OnePlan Solutions
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
Wave PLM
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
ThousandEyes
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
Recently uploaded
(20)
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
What is Binary Language? Computer Number Systems
What is Binary Language? Computer Number Systems
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
How to build immutable data structures in Java
1.
Immutable Data Structures Eric
Fu 2018-06-15
2.
Agenda • Stack • Tree •
Vector Trie • HAMT • Git • LSM-Tree • Practice
3.
Immutable Stack A Clean
Example for Starters
4.
CopyOnWriteArrayList ?
5.
Stack
6.
Stack
7.
Stack
8.
Stack
9.
Immutable Tree
10.
Tree
11.
Tree
12.
RB-Tree
13.
RB-Tree
14.
Vector Trie Immutable Array
List
15.
Trie Also called: • Dictionary
tree • Radix tree • Prefix tree • Digital search tree
16.
Trie (compressed) • With
prefix only "A", "to", "tea", "ted" "ten", "i", "in", "inn"
17.
Vector Trie
18.
Vector Trie (Mutable)
19.
Vector Trie -
Update
20.
Vector Trie -
Push
21.
Vector Trie –
Push (1/3)
22.
Vector Trie –
Push (2/3)
23.
Vector Trie –
Push (3/3)
24.
Vector Trie –
Pop (1/3)
25.
Vector Trie –
Pop (2/3)
26.
Vector Trie –
Pop (3/3)
27.
Complexity • Mostly....
28.
Go Efficient • More
branches
29.
Go Efficient • More
branches • Align to binary bits
30.
Go Efficient • More
branches – 32 • Align to binary bits – 5 bits
31.
Hash Array Mapped
Trie (HAMT) Immutable Hash Table
32.
Rethink Vector Trie •
Must the index be continuous (0, 1, 2...) ? • Actually not! • Furthermore: hash(anything) -> integer
33.
HAMT - Naive •
Contains {0x00, 0xff}
34.
HAMT – Bitmap
Compressed • Compress each node with bitmap
35.
HAMT - Pruned •
Leave out unnecessary nodes
36.
Some Real-world Examples
37.
Git
38.
How Git works? •
Git stored all versions of all directories and files • A Git commit is a snapshot of root directory • A Git branch/tag is a reference to some commit
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
That's it!
53.
Log-Structured Merge-Tree (LSM- Tree)
54.
55.
56.
57.
58.
59.
More Trees
60.
Insights • Modify in
memory • Read merged results • Newly merged blocks are appended
61.
Modern LSM-Tree Implements •
Memtable • Immutable Memtable • Level 0 (overlapped) • Level 1 • Level 2 • .... Memory Disk Write Read 61
62.
Immutable in Practice In
Java
63.
A Familiar Example •
Java's string vs. CPP's string
64.
Easy to understand •
Same name, same value Mutable Request Immutable Request:
65.
Always thread-safe
66.
Always thread-safe • Immutable
to programming as MVCC to database • Lock or Snapshot
67.
Other Pros • Friendly
for caching • Atomic Failure • Avoid null-pointer exception
68.
Java Example 1
69.
Java Example 2 •
Requirement: cache the results of factorizing • Two variable with setter? • Two atomic variable?
70.
Java Example 2
(cont.)
71.
Java Example 2
(cont.)
72.
Thanks! Q&A
Download now