{"id":15583386,"url":"https://github.com/lokic/java-plus","last_synced_at":"2025-03-29T08:23:37.466Z","repository":{"id":45354966,"uuid":"358821777","full_name":"lokic/java-plus","owner":"lokic","description":"在 java8 的基础上提供一些实用的扩展，让java更加好用","archived":false,"fork":false,"pushed_at":"2023-10-25T16:49:55.000Z","size":181,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-03T22:40:53.617Z","etag":null,"topics":["java","java8","sql-join"],"latest_commit_sha":null,"homepage":"","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/lokic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-17T08:10:31.000Z","updated_at":"2022-07-22T03:36:25.000Z","dependencies_parsed_at":"2023-10-23T16:34:05.330Z","dependency_job_id":"26dc72ab-4bc7-4653-a0b0-68b0f548d051","html_url":"https://github.com/lokic/java-plus","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokic%2Fjava-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokic%2Fjava-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokic%2Fjava-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokic%2Fjava-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lokic","download_url":"https://codeload.github.com/lokic/java-plus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246158085,"owners_count":20732718,"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":["java","java8","sql-join"],"created_at":"2024-10-02T20:07:51.859Z","updated_at":"2025-03-29T08:23:37.446Z","avatar_url":"https://github.com/lokic.png","language":"Java","readme":"# java-plus\n\n## 项目简介\n\n在 java8 的基础上提供一些实用的扩展，让java更加好用\n\n## 使用\n\n- 添加依赖\n\n  ```xml\n  \u003cdependency\u003e\n      \u003cgroupId\u003ecom.github.lokic\u003c/groupId\u003e\n      \u003cartifactId\u003ejava-plus\u003c/artifactId\u003e\n      \u003cversion\u003e${lastest.version}\u003c/version\u003e\n  \u003c/dependency\u003e\n  ```\n  \u003e 最新版本[查询](https://search.maven.org/artifact/com.github.lokic/java-plus)\n\n## 部分功能介绍\n\n- 自定义的一些FunctionalInterface：\n\n  - [ThrowXxxx](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/functional/throwable)\n    ：抛出受检异常的FunctionalInterface\n  - [SneakythrowsXxxx](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/sneakythrows)\n    ：偷偷抛出受检异常的FunctionalInterface\n    - 在函数式编程中，如果调用一些方法是会抛出受检异常的，又希望lambda在碰到异常的情况下直接结束，就需要在lambda中强制try catch，然后转换成非受检异常抛出，这么做多了一层转换甚是繁琐。\n    - 使用 SneakyThrowXxxx 的FunctionInterface，可以直接把受检异常变成非受检异常抛出，且不需要任何异常类的重新包装，\n      这样既不需要定义一个统一非受检异常，也不需要定义很多特殊的非受检异常。需要捕获异常的时候也十分方便，直接try catch受检异常就可以了。在代码中也可以更加方便得使用方法引用，使代码看起来更加简洁和优雅。\n  - [TupleXxxx](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/tuple)\n    ：Tuple（元组）相关的FunctionalInterface\n  - [EntryXxxx](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/entry)\n    ：Entry相关的FunctionalInterface\n  - [FunctionX](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/functional/function)\n    、[ConsumerX](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/functional/consumer)\n    、[PredicateX](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/functional/predicate)\n    ：定义了多个入参的Function、Consumer、Predicate\n\n- FunctionalInterface之间的转换：主要查看XxxxFunctional相关的interface\n\n  - [EntryFunctional](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/entry/EntryFunctional.java)\n    ： 转换成Entry相关FunctionalInterface\n  - [SneakyThrowsFunctional](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/sneakythrows/SneakyThrowsFunctional.java)\n    ：转换成SneakyThrow相关的FunctionalInterface\n  - [TupleFunctional](https://github.com/lokic/java-plus/blob/master/src/main/java/com/github/lokic/javaplus/functional/tuple/TupleFunctional.java)\n    ：转换成Tuple（元组）相关的FunctionalInterface\n\n- Lazy：带缓存功能的 Supplier\n\n  - Supplier 每一次执行 Supplier.get() 都会执行一次 Supplier.get() 内的业务逻辑。 如果在一些Supplier.get() 比较耗时的场景，且多次执行 Supplier.get()\n    ，结果相同的情况下， 我们没有必要多次执行，只需要把执行第一次的结果保存下来，之后多次调用直接返回即可，Lazy 就是这个目的设计出来的。\n\n- [Property](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/property)\n  ：在定义枚举类之后，经常需要基于枚举类的某个字段作为key来查询枚举，抽象出这个模块来实现key到枚举的映射和转换逻辑，[示例](https://github.com/lokic/java-plus/tree/master/src/test/java/com/github/lokic/javaplus/property)\n  - Property1、Property2、Property3 分别用于支持不同数量的值作为key来查询枚举的场景\n\n\n- Builder：对POJO提供的通用builder，也可以作为对POJO提供fluent风格的setter\n\n- Fors：提供类似scala中for-comprehensions的能力（for-loop和yield的语法）\n\n  - Optionals.Fors：对Optional的支持\n  - Streams.Fors：对Stream的支持\n  - CompletableFutures.Fors：对CompletableFuture的支持\n\n- Collectors：Collector相关扩展\n\n  - Collectors.Reversed：倒序相关\n  - Collectors.Distinct：去重相关\n\n- [Join](https://github.com/lokic/java-plus/tree/master/src/main/java/com/github/lokic/javaplus/join/Join.java)\n  ：一种类似SQL中join的操作，可以把内存中的Stream流像操作数据库中的表一样进行各种join\n\n   ```java\n   Stream\u003cInteger\u003e streamA = Stream.of(1, 2, 3, 4);\n   Stream\u003cString\u003e streamB = Stream.of(\"1\", \"2\", \"3\");\n   \n   Join.stream(streamA)\n     .leftOuterJoin(streamB, Join.on(a -\u003e String.valueOf(a), b -\u003e b)\n     .stream()   // 转成Stream之后是一个多元组的流，可以结合TupleFunctional进行很多便利的操作\n     .map(...)\n   ```\n\n  \n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokic%2Fjava-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flokic%2Fjava-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokic%2Fjava-plus/lists"}