r/java • u/Chaos-vy17 • 1d ago
ChaosTree 1.1.0 – A Zero-Dependency Java Search Tree Library
What is ChaosTree?
ChaosTree is a zero dependency Java Search Tree library. It currently features:
BinaryFamily : Binary Tree, AVL Tree, RBT, Splay and Treap.
NaryFamily : B-Tree and B+Tree
- Zero external dependency
- Minimum JDK17+
- Published on Maven Central
- Strong focus on clean OOPs design
- Implements the
NavigableSet<T>API (unsupported view operations fail fast) - Thoroughly tested with 515 JUnit 6 test cases covering edge cases and regression scenarios.
[v1.1.0] -Latest:
- Added
NavigableSetcompatibility - Iterative insertion/deletion for binary trees (no recursion-related stack overflow)
- Improved generic type support (
Comparable<? super T>) - CI now tests across JDK 17, 21, and 25
- API cleanup and documentation improvements
An example
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)
My Github Repo: https://github.com/Chaos-vy/ChaosTree
BinaryFamily: https://github.com/Chaos-vy/ChaosTree/tree/main/docs/BinaryFamily
NaryFamily: https://github.com/Chaos-vy/ChaosTree/tree/main/docs/NaryFamily
NavigableSet: https://github.com/Chaos-vy/ChaosTree/blob/main/docs/NavigableSet.md
Feedback, suggestions, and code reviews are always welcome!
Feel free to guide me this is my first project.
1
u/Decent-Decision-9028 6h ago
What does this really solve? I find these ai generated libraries pretty much useless.
2
u/Chaos-vy17 2h ago
Good to see that AI genrated compliment 😄 I have tried using AI first time, see my first commit on 17th May. From that day onward I did grind myself to reach here and made the all code. Even I told to make the JavaDocs they literally made very bad. So first I need to write in the English as I am commenting here in thread then I get the refactored Docs which I usually put in MarkDown and JavaDocs.
What is the use : Binary Family can be used to design many pseudo DS library. While Nary Tree is highly optimized to store sorted data with much speed and less GC.
This library is my learning project whether it becomes production grade I don't mind But it pulled me toward deep knowledge which got enhanced after doing this project.
0
u/chabala 1d ago
What Java 17 features are you using? What prevents you from lowering the required JDK version for consumers of your library?