{"id":19979525,"url":"https://github.com/c-rack/java-pipe","last_synced_at":"2025-05-04T04:33:07.750Z","repository":{"id":52293698,"uuid":"101533931","full_name":"c-rack/java-pipe","owner":"c-rack","description":"Implementation of the Elixir pipe operator behavior in Java","archived":false,"fork":false,"pushed_at":"2021-05-01T05:14:45.000Z","size":9,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-12T06:38:10.725Z","etag":null,"topics":["elixir","java-8","pipe"],"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/c-rack.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":"2017-08-27T06:20:18.000Z","updated_at":"2023-01-31T00:19:21.000Z","dependencies_parsed_at":"2022-09-12T12:12:01.236Z","dependency_job_id":null,"html_url":"https://github.com/c-rack/java-pipe","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fjava-pipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fjava-pipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fjava-pipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/c-rack%2Fjava-pipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/c-rack","download_url":"https://codeload.github.com/c-rack/java-pipe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224385193,"owners_count":17302442,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["elixir","java-8","pipe"],"created_at":"2024-11-13T03:38:06.805Z","updated_at":"2024-11-13T03:38:07.423Z","avatar_url":"https://github.com/c-rack.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# java-pipe\n\nImplementation of the [Elixir pipe operator](https://elixirschool.com/en/lessons/basics/pipe-operator/) behavior in Java.\n\nFunctions with up to 3 (TriFunction) respectively 4 (QuadriFunction) arguments are supported.\n\n## Description\n\nIn [Elixir](https://elixir-lang.org/),\na value can be passed to a function using the pipe operator (`|\u003e`),\nwhere the value is automatically used as first argument of the function.\n\nWhile Java 8 has introduced [function composition](https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html) with `.andThen()`, it is not exactly what I was searching for when trying to mimic\nElixir's pipe operator in Java. So I wrote this small class and hope someone finds it useful.\n\n## Usage example\n\n```java\napply(\"ab\")\n  .pipe((a) -\u003e a.toUpperCase())                 // \"AB\"\n  .pipe((a, b) -\u003e a.replace('A', b), '1')       // \"1B\"\n  .pipe((a, b, c) -\u003e a.replace(b, c), 'B', '2') // \"12\"\n  .pipe((a) -\u003e Integer.valueOf(a))              // 12\n  .pipe((a, b, c, d) -\u003e a + b * c - d, 1, 2, 3) // 11\n  .pipe((a) -\u003e a.toString())                    // \"11\"\n  .result()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-rack%2Fjava-pipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fc-rack%2Fjava-pipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fc-rack%2Fjava-pipe/lists"}