Extracts names of lambda parameters
Java
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
header.txt
notes.md
pom.xml

README.md

Extracts parameter names from Java 8 lambdas

Extracts parameter name from lambda. Inspired by Benji Weber's code

Usage:

import net.javacrumbs.lambdaextractor.ParameterNameExtractor

...
// lambda type has to be serializable
SerializableFunction lambda = name -> "a";
ParameterNameExtractor.extractParameterNames(lambda); // returns "name"

...
// lambda type has to be serializable
SerializableBiFunction lambda = (name1, name2) -> "a";
ParameterNameExtractor.extractParameterNames(lambda); // returns name1, name2
ParameterNameExtractor.extractFirstParameterName(lambda); // return name1

Maven dependency

<dependency>
    <groupId>net.javacrumbs</groupId>
    <artifactId>lambda-param-name-extractor</artifactId>
    <version>0.1.0</version>
</dependency>