batterseapower / btreemap Goto Github PK
View Code? Open in Web Editor NEWA simple and high-performance Java B-tree: drop-in replacement for java.util.TreeMap
License: Apache License 2.0
A simple and high-performance Java B-tree: drop-in replacement for java.util.TreeMap
License: Apache License 2.0
Could the README include a memory usage comparison between TreeMap
and BTreeMap
?
I have been looking at your library, and it looks quite neat.
Thanks.
Would you consider adding a clone() method? Use case is to freeze a map state for further processing while continuing to mutate the original map.
This code:
BTreeMap<Integer, Integer> map = BTreeMap.create();
for (int i = 0; i < 1000; i++) {
map.put(i, i);
}
for (int i = 0; i < 481; i++) {
map.remove(i);
}
map.get(481); // this line fails with NullPointerException
fails with exception:
Exception in thread "main" java.lang.NullPointerException
at uk.co.omegaprime.btreemap.BTreeMap$Internal.find(BTreeMap.java:221)
at uk.co.omegaprime.btreemap.BTreeMap.findLeaf(BTreeMap.java:491)
at uk.co.omegaprime.btreemap.BTreeMap.getOrDefault(BTreeMap.java:501)
at uk.co.omegaprime.btreemap.BTreeMap.get(BTreeMap.java:470)
at Test.main(Test.java:22)
The code uses sun.misc.Unsafe
which isn't supported anymore in Java 17:
The problem can be fixed by replacing it with jdk.internal.misc.Unsafe.objectFieldOffset
but it would be better to altogether get rid of the usage of Unsafe.
It would be really nice to make constructors in BTreeMap
public, so the API of BTreeMap
will be the same as for TreeMap
. Until, if I just want to try how things got faster with a BTreeMap
in my project, I can't replace TreeMap
with a BTreeMap
automatically, since I need to manually replace all constructor calls with BTreeMap
factory methods.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.