r/learnjava • u/fishybusinessdev • 6d ago
Building My Custom Data Structure Library Feed-Back pt. 2
A while ago, I posted about a small project I was working on for fun: a Java library for N-dimensional array storage and manipulation.
Originally, I made it for my own game, but eventually decided to put it on GitHub in case anyone else found it useful. I posted here to get feedback, suggestions, and criticism, and I ended up learning quite a bit from the comments.
Since then, I've made several changes, reconsidered some of my original design decisions, and released a new version.
I'd love to get some more feedback: What's good? What's bad? What could be improved? Are there any questions you have about the library or its implementation? I'm open to constructive criticism and suggestions.
I know this kind of library isn't for everyone, and that's perfectly fine. Some people will prefer working directly with Java arrays or existing collections, and I understand that. I'm mainly interested in hearing what you think of the implementation, API, documentation, and overall usefulness.
I'm also interested in feedback on the presentation. I got some comments about the README being hard to read(kinda defeats the purpose, huh?), so I've redesigned it and added more information. Hopefully, that helps.
Anyway, here's the GitHub:
View all comments
Show parent comment
1
u/fishybusinessdev 4d ago
That's actually a core part of the design.
JArray supports both homogeneous and heterogeneous data. When storing homogeneous primitive data, it uses the corresponding native primitive array, avoiding the boxing overhead of storing everything in an Object[]. When storing mixed types, it can maintain separate primitive storage alongside the other types.
Generics wouldn't directly accomplish this in Java, since generic types can't be primitive and would still require boxing.
The use case is a general-purpose N-dimensional array that can handle both typed primitive data and heterogeneous data, while retaining efficient primitive storage where possible.
Whether that trade-off is worthwhile is a fair question, but the multiple arrays are intentional, not redundant.