{"id":17994658,"url":"https://github.com/noties/nullsafe","last_synced_at":"2025-03-26T02:31:05.534Z","repository":{"id":57742758,"uuid":"108412491","full_name":"noties/NullSafe","owner":"noties","description":"Null safe flow for Java \u0026 Android","archived":true,"fork":false,"pushed_at":"2017-10-27T09:21:00.000Z","size":60,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T16:43:02.265Z","etag":null,"topics":["android","java","null"],"latest_commit_sha":null,"homepage":null,"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/noties.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-10-26T13:04:45.000Z","updated_at":"2023-07-16T22:52:12.000Z","dependencies_parsed_at":"2022-09-09T10:11:01.715Z","dependency_job_id":null,"html_url":"https://github.com/noties/NullSafe","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noties%2FNullSafe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noties%2FNullSafe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noties%2FNullSafe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noties%2FNullSafe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noties","download_url":"https://codeload.github.com/noties/NullSafe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245576528,"owners_count":20638125,"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":["android","java","null"],"created_at":"2024-10-29T20:15:59.008Z","updated_at":"2025-03-26T02:31:05.155Z","avatar_url":"https://github.com/noties.png","language":"Java","readme":"# NullSafe\n\n[![Maven Central](https://img.shields.io/maven-central/v/ru.noties/nullsafe.svg)](http://search.maven.org/#search|ga|1|g%3A%22ru.noties%22%20AND%20a%3A%22nullsafe%22)\n\nNull safe flow for Java.\n\nJava8:\n\n```java\n// `country` can be null, meaning that no mapping will occur and \"Unknown\" will be returned\nfinal String name = NullSafe.create(country)\n        .map(Country::city) // map function will never call Supplier with null argument\n        .map(City::street)\n        .map(Street::name)\n        .get(\"Unknown\");\n```\n\n```java\n\nfinal City capitalCity = capitalCity();\n\nfinal String name = NullSafe.create(country)\n        .map(capitalCity, Country::city) // allows to specify def values (cannot be null)\n        .map(City::street)\n        .map(Street::name)\n        .get(\"Unknown\");\n```\n\n\n```java\n\n// NullSafe instance can be used to split the flow (safe to reference intermediate state)\n\nfinal NullSafe\u003cCity\u003e nullSafe = NullSafe.create(country)\n        .map(capitalCity, Country::city);\n\nfinal String name = nullSafe\n        .map(City::street)\n        .map(Street::name)\n        .get(); // \u003c- returns nullable if no def value was specified\n\nfinal House house = nullSafe\n        .map(City::street)\n        .map(Street::house)\n        .get();\n```\n\nThis utility class is **not** thread-safe","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoties%2Fnullsafe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoties%2Fnullsafe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoties%2Fnullsafe/lists"}