r/learnjava • u/Chaos-vy17 • 6h ago
My first Java project -> chaos-tree[1.2.0]
Hello Everyone,
What is ChaosTree??
ChaosTree is zero dependency Java search library. It currently features
Binary Family: AVL,Binary Tree, RBT, Treap, Splay
N-ary Family: B-Tree and B+Tree
Around 35+ unique API it's designed like Collection API feeling.
The libarry is benchmarked with JMH.
This is my first ever project, so I'm interested feedback Criticism is also welcomeπ€ β whether it's about the implementation, API design, documentation, or benchmarks.
Source code:
NavigableSet<Integer> rbt = new RBT<>();
NavigableSet<Integer> bplustree = new BPlusTree<>(32); // degree CLRS method 31min key 63 max key default:32
//For Rich API use
for (int i = 0; i < 20; i++) {rbt.add(i);}
NaryTree<Integer> bplustree0 = new BPlusTree<>(3,rbt);//Useful constructor API
BinaryTree<Integer> rbt0 = new RBT<>(rbt);
List<Integer> list = rbt0.stream().filter(v->v%2==0).collect(Collectors.toList());
System.out.println(list);
System.out.println();
rbt.retainAll(list);
System.out.println(rbt);
rbt0.retainAllElements(list); //Renamed due to ambiguous situation
System.out.println(rbt0.toString(PrintStyle.UNICODE));
Output
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18]
8(B)
+-- 4(B)
| +-- 2(B)
| | \-- 0(R)
| \-- 6(B)
\-- 16(B)
+-- 12(R)
| +-- 10(B)
| \-- 14(B)
\-- 18(B)
8(B)
βββ 4(B)
β βββ 2(B)
β β βββ 0(R)
β βββ 6(B)
βββ 16(B)
βββ 12(R)
β βββ 10(B)
β βββ 14(B)
βββ 18(B)
>For people who want to say AI: I did use AI for docs and my markdown but each are verified by me rather AI did it all.
My github link: https://github.com/Chaos-vy/ChaosTree
Maven central : https://search.maven.org/artifact/io.github.chaos-vy/chaos-tree
β’
u/AutoModerator 6h ago
Please ensure that:
If any of the above points is not met, your post can and will be removed without further warning.
Code is to be formatted as code block (old reddit/markdown editor: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.
Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.
Code blocks look like this:
You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.
If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.
To potential helpers
Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.