Skip to content

[Feature Request] Tuple #80

@siujamo

Description

@siujamo

Feature Request for OnixByte Toolbox

Summary

Add a generic Tuple class to OnixByte Toolbox for easy grouping of two or more values.

Why is this needed?

Currently, when we need to return multiple values from a method or group related values without creating a dedicated class, we have to use awkward approaches like arrays or maps, which are not type-safe or expressive. A Tuple class would simplify this and improve code clarity and type safety.

What’s your idea?

Introduce a Tuple class with generic parameters, e.g., Tuple<A, B>, Tuple<A, B, C>, etc., that can hold fixed numbers of elements. Provide typical methods like getters, equals, hashCode, and toString. Optionally, include utility factory methods for convenience.

Alternatives

We’ve considered using Apache Commons Pair or JavaFX’s Pair, but these add external dependencies or lack support for more than two elements. Creating custom classes every time is cumbersome and leads to boilerplate code.

Target version (optional)

Any other info

This feature aligns well with OnixByte Toolbox’s goal of streamlining Java development by providing reusable utilities.


Thanks for helping us improve OnixByte Toolbox! Looking forward to your ideas.

Metadata

Metadata

Assignees

Labels

feature requestRequest for an inexistent feature

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions