{"id":37028111,"url":"https://github.com/mmnaseri/tuples4j","last_synced_at":"2026-01-14T03:21:14.436Z","repository":{"id":54992360,"uuid":"259777130","full_name":"mmnaseri/tuples4j","owner":"mmnaseri","description":"Fluent tuples for Java","archived":false,"fork":false,"pushed_at":"2023-05-09T18:48:11.000Z","size":320,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"development","last_synced_at":"2025-07-12T03:13:20.386Z","etag":null,"topics":["fp","functional","functional-programming","functions","java","tuples"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mmnaseri.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-28T23:41:35.000Z","updated_at":"2023-03-12T08:54:39.000Z","dependencies_parsed_at":"2022-08-14T08:30:37.635Z","dependency_job_id":null,"html_url":"https://github.com/mmnaseri/tuples4j","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mmnaseri/tuples4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmnaseri%2Ftuples4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmnaseri%2Ftuples4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmnaseri%2Ftuples4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmnaseri%2Ftuples4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mmnaseri","download_url":"https://codeload.github.com/mmnaseri/tuples4j/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mmnaseri%2Ftuples4j/sbom","scorecard":{"id":654558,"data":{"date":"2025-08-11","repo":{"name":"github.com/mmnaseri/tuples4j","commit":"5e812c6993c2a525c650bfe97c0a0a6323c2664b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/7 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:1: pin your Docker image by updating ubuntu:bionic to ubuntu:bionic@sha256:152dc042452c496007f07ca9127571cb9c29697f42acbfad72324b2bb2e43c98","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during GetBranch(master): error during branchesHandler.query: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T14:18:49.714Z","repository_id":54992360,"created_at":"2025-08-21T14:18:49.714Z","updated_at":"2025-08-21T14:18:49.714Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408825,"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":["fp","functional","functional-programming","functions","java","tuples"],"created_at":"2026-01-14T03:21:13.583Z","updated_at":"2026-01-14T03:21:14.431Z","avatar_url":"https://github.com/mmnaseri.png","language":"Java","funding_links":["https://paypal.me/mmnaseri"],"categories":[],"sub_categories":[],"readme":"# tuples4j\n\n[![Donae](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://paypal.me/mmnaseri)\n[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.mmnaseri.utils/tuples4j/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.mmnaseri.utils/tuples4j)\n[![Build Status](https://travis-ci.org/mmnaseri/tuples4j.svg?branch=master)](https://travis-ci.org/mmnaseri/tuples4j)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1d667baee2084c42bf3c4b1db9c8a30e)](https://www.codacy.com/manual/mmnaseri/tuples4j?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=mmnaseri/tuples4j\u0026amp;utm_campaign=Badge_Grade)[![CodeFactor](https://www.codefactor.io/repository/github/mmnaseri/tuples4j/badge)](https://www.codefactor.io/repository/github/mmnaseri/tuples4j)\n[![Coverage Status](https://coveralls.io/repos/github/mmnaseri/tuples4j/badge.svg)](https://coveralls.io/github/mmnaseri/tuples4j)\n\n---\n\nA tiny library for working with [tuples](https://en.wikipedia.org/wiki/Tuple) as first-class citizens, in Java.\n\nThis library has been designed to play well with Java 8+'s collections and streams APIs and fits nicely into the\nfunctional programming paradigm familiar to Java 8 developers.\n\nThis code is well tested, and is easy to parse.\n\n## Getting Starting\n\nTo download the code and use it in your project, you can either clone this project and start using it:\n\n    $ git clone https://github.com/mmnaseri/tuples4j.git\n\nor you can add a maven dependency since it is now available in Maven central:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.mmnaseri.utils\u003c/groupId\u003e\n        \u003cartifactId\u003etuples4j\u003c/artifactId\u003e\n        \u003cversion\u003e${tuples4j.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\nTo get started, use one of the many utility methods under the `Tuple` interface as the entrypoint:\n\n```java\nThreeTuple\u003cObject, Integer, String, Boolean\u003e t = Tuple.three(1, \"x\", true);\n\n// Or, if you prefer to get rid of the type-safety mechanism:\nTuple\u003c?\u003e t = Tuple.three(1, \"x\", true);\n```\n\nTuples are immutable, so, feel free to pass them around:\n\n```java\n// Create a bunch of one-tuples.\nSet\u003cTuple\u003c?\u003e\u003e tuples = Stream.of(Tuple.of(1), Tuple.of(2))\n    // Extend them each to two-tuples.\n    .map(Tuple.extendOne(\"Hello\")) // this is the same as: .map(t -\u003e t.extend(\"Hello\"))\n    // Change the first element.\n    .map(t -\u003e t.first(Objects::toString))\n    // Sort by the second element. \n    .sorted(Comparator.comparing(HasSecond::second))\n    // Collect them all as a set.\n    .collect(toSet());\n```\n\n## Features\n\n### JDK 8-14 Compatible\n\nThis project is regular built against and tested with OpenJDK 8 - 14. Click on the build badge above to find out more.\n\n### Tuple Sizes\n\nThis library offers a wide set of tuples, from size 0 (the *empty* tuple), to size 12 and beyond.\n\nThe build-in tuple sizes are:\n\n  * `EmptyTuple`,\n  * `OneTuple`,\n  * `TwoTuple`, also available as `Pair` and `KeyValue`,\n  * `ThreeTuple`,\n  * `FourTuple`,\n  * `FiveTuple`,\n  * `SixTuple`,\n  * `SevenTuple`,\n  * `EightTuple`,\n  * `NineTuple`,\n  * `TenTuple`,\n  * `ElevenTuple`,\n  * `TwelveTuple`.\n\nBeyond these, there is the `ThirteenOrMoreTuple` class which holds data for thirteen or more elements.\n\n### Type-safe Elements\n\nAll elements are bound to an individual type argument, meaning that you can carry that type information\nand will not need to cast the items to the actual types.\n\nMoreover, each tuple type has a tightly bound, generically defined constructor and factory method, that\ncan be used if you want to enforce an upperbound on the datatypes. For instance, to create a number-only\nthree-tuple, you can write:\n\n```java\nThreeTuple\u003cNumber, Integer, Double, Long\u003e tuple = ThreeTuple.of(1, 1.2D, 3L);\n```\n\n### `equals`, `hashCode()`, and `toString()`\n\nAll tuples have their own implementation of these three basic methods. These are also well-tested\nand you can consult the tests for examples.\n\nFor instance:\n\n```java\nTuple.of(1, 2, 3).equals(Tuple.of(1, 2, 3, \"a\").dropFourth()) // =\u003e true\n```\n\n### Labeled Tuples\n\nSome applications might require access to datum by labels. In this case, you can easily label your\ntuples like so:\n\n```java\nLabeledTuple\u003c?\u003e t = Tuple.of(\"USA\", 3.2).withLabels(\"country\", \"population\");\nSystem.out.println(t.get(\"population\")); // =\u003e 3.2\n```\n\n### Named Accessors\n\nAll tuples which have a fixed dimension, have facades that allow named interactions. For instance,\na four-tuple, would implement all the facades for `HasFirst`, `HasSecond`, `HasThird`, and `HasFourth`.\n\nThis means that to get the second element in the tuple, instead of writing `tuple.get(1)`, you can\nwrite `tuple.second()`. This also applies to changing values on the tuples. Instead of calling\n`tuple.change(2, \"a\")`, you can write `tuple.third(\"a\")`. Not only is this syntax semantically\nstronger, but also it can help preserve type arguments on the tuple itself.\n\n## Reflective Access\n\nThe companion module `tuples4j-reflection` can be used to get tuples represented as classes:\n\n```java\nReflectiveTuple\u003c?\u003e reflectiveTuple = ReflectiveTuple.of(tuple);\nCustomer customer = reflectiveTuple.as(Customer.class);\nString name = customer.name();\nBigDecimal income = customer.income();\n```\n\nYou can do all sorts of customizations in how a value is read from the tuple and conveyed as a method's return value:\n\n```java\npublic interface Customer {\n\n  String name();\n  \n  BigDecimal income();\n  \n  State state();\n\n  @Provided(by = IncomeBracketProvider.class)\n  IncomeBracket incomeBracket();\n  \n  double raise();\n  \n  default nextYearIncome() {\n    return income().multiply(raise());\n  }\n  \n  enum State {\n    TX, WA, CA, OR\n  }\n\n}\n```\n\nLook at [tuples4j-reflection/~/test/~/model/Country.java](https://github.com/mmnaseri/tuples4j/blob/master/tuples4j-reflection/src/test/java/com/mmnaseri/utils/tuples/model/Country.java) for a better example of the sort of things you can do with the reflective code.\n\n### Using the Reflection Module\n\nTo use the reflection module, get yourself a copy by either cloning this project or using Maven:\n\n    \u003cdependency\u003e\n        \u003cgroupId\u003ecom.mmnaseri.utils\u003c/groupId\u003e\n        \u003cartifactId\u003etuples4j-reflection\u003c/artifactId\u003e\n        \u003cversion\u003e${tuples4j.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n\n## Building and Contributing\n\nContributions are more than welcome :)\n\nTo build the code and/or to contribute, you can use the provided `Dockerfile` image. This image sets up an Ubuntu Bionic (18.04 LTS) with OpenJDK 8. This is the minimum required environment for the project to work.\n\nYou can get a working Docker image by running:\n\n```bash\ndocker build -t tuples4j:jdk8 .\ndocker run -it tuples4j:jdk8\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmnaseri%2Ftuples4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmmnaseri%2Ftuples4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmmnaseri%2Ftuples4j/lists"}