{"id":33143314,"url":"https://github.com/arxila/javatuples","last_synced_at":"2026-01-14T03:40:17.075Z","repository":{"id":309800816,"uuid":"1036871622","full_name":"arxila/javatuples","owner":"arxila","description":"A complete implementation of tuple data structures for Java.","archived":false,"fork":false,"pushed_at":"2025-09-04T20:51:10.000Z","size":263,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T23:51:59.207Z","etag":null,"topics":["data-structures","java","tuples"],"latest_commit_sha":null,"homepage":"https://javatuples.arxila.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arxila.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-12T17:51:38.000Z","updated_at":"2025-10-14T06:24:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"53ca7d4e-b063-48ef-a565-5defd5675980","html_url":"https://github.com/arxila/javatuples","commit_stats":null,"previous_names":["arxila/javatuples"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/arxila/javatuples","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxila%2Fjavatuples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxila%2Fjavatuples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxila%2Fjavatuples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxila%2Fjavatuples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arxila","download_url":"https://codeload.github.com/arxila/javatuples/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arxila%2Fjavatuples/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408854,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-structures","java","tuples"],"created_at":"2025-11-15T13:00:25.542Z","updated_at":"2026-01-14T03:40:17.067Z","avatar_url":"https://github.com/arxila.png","language":"Java","funding_links":[],"categories":["I. Development"],"sub_categories":["6. Useful libraries"],"readme":"JavaTuples\n==========\n\nJavaTuples is a simple Java library that provides a set of tuple classes. It includes:\n\n  * A general tuple interface: `io.arxila.javatuples.Tuple`\n  * A set of _named_ tuple classes: `Empty`, `Solo`, `Pair`, `Trio`, `Quartet`, `Quintet`, `Sextet`, `Septet`, `Octet`, `Nonet`, `Decet`\n  * A set of _numbered_ tuple classes: `Tuple0`, `Tuple1`, `Tuple2`, `Tuple3`, `Tuple4`, `Tuple5`, `Tuple6`, `Tuple7`, `Tuple8`, `Tuple9`, `Tuple10`\n  * Some common tuple-shaped utility classes: `KeyValue`, `LabelValue`, `MapEntry`\n\nAll tuples are \u003cins\u003e**immutable**\u003c/ins\u003e, and therefore \u003cins\u003e**thread-safe**\u003c/ins\u003e. They are also **iterable**\nand **serializable**. Tuples are implemented as Java [records](https://docs.oracle.com/en/java/javase/17/language/records.html).\n\nJavaTuples is open-source and distributed under the **Apache License 2.0**.\n\n\u003e [!NOTE]\n\u003e This library is a new incarnation of the previous `org.javatuples` library which could be previously found \n\u003e at [javatuples](https://github.com/javatuples/javatuples). This new library starts at version 2.x, it is a\n\u003e complete rewrite of the previous one and it is not backward compatible.\n\n\nRequirements\n------------\n\nJavaTuples requires **Java 17**.\n\n\nMaven Info\n----------\n\nLibrary dependency: `io.arxila.javatuples:javatuples:{version}`\n\nFrom Maven:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.arxila.javatuples\u003c/groupId\u003e\n  \u003cartifactId\u003ejavatuples\u003c/artifactId\u003e\n  \u003cversion\u003e{version}\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\nTuples\n------\n\nA tuple is just a sequence of objects that do not necessarily relate to each other in any way. For\nexample, `[23, \"Saturn\", java.sql.Connection@li734s]` can be considered a tuple of three elements (a triple,\nor _trio_) containing an `Integer`, a `String`, and a JDBC `Connection` object.\n\nJavaTuples offers two types of tuples: **named** and **numbered**. Named tuples have names that represent\ntheir arity (e.g. `Trio`), while numbered tuples include arity in their names (e.g. `Tuple3`). All\ntuple implementations reside in the `io.arxila.javatuples` package, and they all implement\nthe `io.arxila.javatuples.Tuple` interface.\n\nNamed tuples are:\n\n  * `Empty` (0 elements)\n  * `Solo\u003cA\u003e` (1 element)\n  * `Pair\u003cA,B\u003e` (2 elements)\n  * `Trio\u003cA,B,C\u003e` (3 elements)\n  * `Quartet\u003cA,B,C,D\u003e` (4 elements)\n  * `Quintet\u003cA,B,C,D,E\u003e` (5 elements)\n  * `Sextet\u003cA,B,C,D,E,F\u003e` (6 elements)\n  * `Septet\u003cA,B,C,D,E,F,G\u003e` (7 elements)\n  * `Octet\u003cA,B,C,D,E,F,G,H\u003e` (8 elements)\n  * `Nonet\u003cA,B,C,D,E,F,G,H,I\u003e` (9 elements)\n  * `Decet\u003cA,B,C,D,E,F,G,H,I,J\u003e` (10 elements)\n\nNumbered tuples are:\n\n  * `Tuple0` (0 elements)\n  * `Tuple1\u003cA\u003e` (1 element)\n  * `Tuple2\u003cA,B\u003e` (2 elements)\n  * `Tuple3\u003cA,B,C\u003e` (3 elements)\n  * `Tuple4\u003cA,B,C,D\u003e` (4 elements)\n  * `Tuple5\u003cA,B,C,D,E\u003e` (5 elements)\n  * `Tuple6\u003cA,B,C,D,E,F\u003e` (6 elements)\n  * `Tuple7\u003cA,B,C,D,E,F,G\u003e` (7 elements)\n  * `Tuple8\u003cA,B,C,D,E,F,G,H\u003e` (8 elements)\n  * `Tuple9\u003cA,B,C,D,E,F,G,H,I\u003e` (9 elements)\n  * `Tuple10\u003cA,B,C,D,E,F,G,H,I,J\u003e` (10 elements)\n\nAdditionally, JavaTuples provides a small set of tuple-shaped utility classes:\n\n  * `KeyValue\u003cK,V\u003e`\n  * `LabelValue\u003cL,V\u003e`\n  * `MapEntry\u003cK,V\u003e` (implements the `java.util.Map.Entry` interface)\n\n\nUsage\n-----\n\n### Creating Tuples\n\nTuples are easy to create using constructors:\n```java\n// Named tuples\nvar pair = new Pair\u003c\u003e(\"Hello\", 42);              // pair : Pair\u003cString, Integer\u003e\nvar trio = new Trio\u003c\u003e(\"A\", \"B\", \"C\");            // trio : Trio\u003cString, String, String\u003e\n\n// Numbered tuples \nvar tuple2 = new Tuple2\u003c\u003e(\"Hello\", 42);          // tuple2 : Tuple2\u003cString, Integer\u003e\n```\nOr using static `of(...)` factory methods:\n```java\n// Named tuples\nvar pair = Pair.of(\"Hello\", 42);                 // pair : Pair\u003cString, Integer\u003e\nvar trio = Trio.of(\"A\", \"B\", \"C\");               // trio : Trio\u003cString, String, String\u003e\n\n// Numbered tuples \nvar tuple2 = Tuple2.of(\"Hello\", 42);             // tuple2 : Tuple2\u003cString, Integer\u003e\n```\nThey can also be created from arrays or lists of the exact size, though in that case, all elements of\nthe tuple are treated as the same type (the component type of the array or list):\n```java\nvar valuesList = List.of(\"Hello\", 42);           // valuesList: List\u003cObject\u003e (effectively)\nvar valuesArray = new String[] {\"A\", \"B\", \"C\"};  // valuesArray: String[]\n// ...\nvar pair = Pair.of(valuesList);                  // pair : Pair\u003cObject, Object\u003e\nvar trio = Trio.of(valuesArray);                 // trio : Trio\u003cString, String, String\u003e\n```\n\n### Accessing Values\n\nValues in tuples are numbered from 0 to N-1, and can be accessed using the `valueN()` methods:\n\n```java\n// Direct access\nString value0 = pair.value0();\nInteger value1 = pair.value1();\nLong value9 = decet.value9();\n\n// All values as a list\nvar values = tuple.values();     // values: List\u003cObject\u003e\n```\nTuples are also iterable and provide several useful `contains*` methods:\n\n```java\n// Iteration\nfor (final Object value : tuple) {\n    // ...do things\n}\n\n// Contains methods\nif (tuple.contains(\"Hello\")) {...}        // true if a single value is contained in the tuple\nif (tuple.containsAll(\"Hello\", 42)) {...} // true if all specified values are contained in the tuple\nif (tuple.containsAny(41,4 2)) {...}      // true if any of the specified values are contained in the tuple\n```\n\nAn `equalsIgnoreOrder()` method is also provided to compare tuples ignoring the order of their values:\n\n```java\nif (tuple.equalsIgnoreOrder(otherTuple)) {...}  // true if tuples contain the same values in any order\n```\n\n### Modifying Values\n\nTuples are immutable, but you can create new instances with modified contents using _wither_ methods\n(methods that return a new tuple with one value replaced):\n\n```java\nvar pair = Pair.of(\"Hello\", 42);            // Pair\u003cString,Integer\u003e(\"Hello\", 42)\nvar newPair = pair.withValue1(\"World\");     // Pair\u003cString,String\u003e(\"Hello\", \"World\")\n```\n\n### Growing and Shrinking\n\nAdding a new element at index N (`withValueN(...)`) will grow the tuple: a new tuple one element\nlarger is created, with the new element appended.\n\nRemoving an element from any index (`withoutValueX(...)`) will shrink the tuple: a new tuple one\nelement smaller is created, with that element removed.\n\n```java\nvar pair = Pair.of(\"Hello\", 42);            // Pair\u003cString,Integer\u003e\nvar trio = pair.withValue2(\"!\");            // Grow to Trio\u003cString,Integer,String\u003e\nvar solo = pair.withoutValue1();            // Shrink to Solo\u003cString\u003e\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxila%2Fjavatuples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farxila%2Fjavatuples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farxila%2Fjavatuples/lists"}