{"id":18863610,"url":"https://github.com/neiljbrown/java-functional-interface-examples","last_synced_at":"2026-02-11T00:30:18.374Z","repository":{"id":89469392,"uuid":"216056220","full_name":"neiljbrown/java-functional-interface-examples","owner":"neiljbrown","description":"A set of Java code examples illustrating the set of functional interfaces that were added to the JDK's java.util.function package in Java 8+.","archived":false,"fork":false,"pushed_at":"2019-10-18T15:40:01.000Z","size":125,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-30T21:24:09.274Z","etag":null,"topics":["examples","functional-programming","java"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neiljbrown.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-10-18T15:37:19.000Z","updated_at":"2023-02-21T15:11:53.000Z","dependencies_parsed_at":"2023-03-13T18:09:29.412Z","dependency_job_id":null,"html_url":"https://github.com/neiljbrown/java-functional-interface-examples","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiljbrown%2Fjava-functional-interface-examples","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiljbrown%2Fjava-functional-interface-examples/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiljbrown%2Fjava-functional-interface-examples/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neiljbrown%2Fjava-functional-interface-examples/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neiljbrown","download_url":"https://codeload.github.com/neiljbrown/java-functional-interface-examples/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239808473,"owners_count":19700443,"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":["examples","functional-programming","java"],"created_at":"2024-11-08T04:38:00.060Z","updated_at":"2026-02-11T00:30:18.263Z","avatar_url":"https://github.com/neiljbrown.png","language":"Java","readme":"= Java Functional Interfaces\n:sectlinks:\n:sectnums:\n:sectnumlevels: 4\n:toclevels: 4\n\n== Purpose\nThis project provides a set of Java code examples illustrating the set of functional interfaces that were added to\nthe JDK's java.util.function package in Java 8+, their general use cases and usage in the standard JDK library (Stream\n and Collection APIs).\n\nThe examples are implemented as a set of easy to run tests, using JUnit (5), in a Gradle (or Maven) project.\n\n== Source Code\nThe source code for the examples can be found in the src/test/java folder.\n\nThe following list summarises the class names of each of the examples and which functional interface they cover, and\nprovides a suggested logical reading order for learning about  them -\n\n. FunctionExamplesTest - Examples of using the simplest class of functional interface - java.util.function.Function,\nwhich represents an operation on a _single_ operand that produces a result.\n\n. PrimitiveFunctionSpecialisationExamplesTest - Examples of using using the specialised subset of functional interfaces\nthat represent an operation that accepts a single argument and returns a computed value, which can be applied to, or\nreturn _primitive_ data-types (int, long, double).\n\n. BiFunctionExamplesTest - Examples of using the java.util.function.BiFunction interface, which represents an\noperation on _two_ operands that produces a result.\n\n. SupplierExamplesTest - Examples of using the java.util.function.Supplier interface, which represents an operation\nwith zero operands/args that returns a result.\n\n. ConsumerExamplesTest - Examples of using the java.util.function.Consumer and BiConsumer interfaces, which represent\n an operation on one operand, or two operands, respectively, that do _not_ produce a result.\n\n. PredicateExamplesTest - Examples of using the java.util.function.Predicate interface, which represents an operation\non a single operand/argument that returns a boolean result.\n\n. OperatorExamplesTest - Examples of using the java.util.function.UnaryOperator and java.util.function.BinaryOperator\n interfaces which are specialisations of a function that both receive and return the same type/class of value.\n\nAn explanation of these functional interfaces, along with guidance on their usage, can be found in the\nJavadoc of each of the code examples. (See the commands for generating Javadoc below).\n\n== Generating IDE Projects\nIf you'd like to view the source in an IDE, the project's Gradle build script supports generating IDE project files\nfor both Eclipse and IntelliJ IDEA.\n\nTo generate an Eclipse project use the following command:\n\n`./gradlew cleanEclipse eclipse`\n\nTo generate an IntelliJ IDEA project use the following command:\n\n`./gradlew cleanIdea idea`\n\n== Building and Running the Examples\nYou will need to install a Java 11 JDK.\n\nSupport is provided for building and running the project using either Gradle or Maven as described in the sections\nbelow.\n\n=== Gradle\nThe minimum required version of Gradle will be installed if you execute the build using the supplied Gradle wrapper\nscript (./gradlew).\n\nTo compile and run all the example tests, enter the  following command in the project's root folder:\n\n`./gradlew clean test`\n\nTo generate the Javadoc, use the following command:\n\n`./gradlew clean javadocTests`\n\nThe generated Javadoc can be found in the standard location for a Gradle project - build/docs/javadoc/index.html.\n\nFor more details of Gradle build support see build.gradle in the project's root folder.\n\n=== Maven\nThe minimum required version of Maven will be installed if you execute the build using the supplied Maven wrapper\nscript (./mvnw).\n\nTo compile and run all the example tests, enter the following command in the project's root folder:\n\n`./mvnw clean test`\n\nTo generate the Javadoc, use the following command:\n\n`./mvnw javadoc:test-javadoc`\n\nThe generated Javadoc can be found in the standard location for a Maven project - target/site/testapidocs/index.html.\n\nFor more details of Maven build support see pom.xml in the project's root folder.\n\n\nEnd\n\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneiljbrown%2Fjava-functional-interface-examples","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneiljbrown%2Fjava-functional-interface-examples","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneiljbrown%2Fjava-functional-interface-examples/lists"}