Skip to content

Commit

Permalink
Switch from anonymous inner classes to lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
emmileaf committed Aug 22, 2022
1 parent 798882d commit b79d5ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import javax.inject.Inject;
import org.gradle.api.Action;
import org.gradle.api.Project;
import org.gradle.api.Transformer;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.MapProperty;
Expand Down Expand Up @@ -112,14 +111,10 @@ public void setPaths(Provider<Object> paths) {
// Convert Provider<Object> to Provider<List<ExtraDirectoryParameters>>
this.paths.set(
paths.map(
new Transformer<List<ExtraDirectoryParameters>, Object>() {
@Override
public List<ExtraDirectoryParameters> transform(Object obj) {
return project.files(paths).getFiles().stream()
obj ->
project.files(paths).getFiles().stream()
.map(file -> new ExtraDirectoryParameters(objects, project, file.toPath(), "/"))
.collect(Collectors.toList());
}
}));
.collect(Collectors.toList())));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.List;
import javax.inject.Inject;
import org.gradle.api.Project;
import org.gradle.api.Transformer;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
Expand Down Expand Up @@ -72,15 +71,8 @@ public void setFrom(Object from) {
}

public void setFrom(Provider<Object> from) {
this.from.set(
// Convert Provider<Object> to Provider<Path>
from.map(
new Transformer<Path, Object>() {
@Override
public Path transform(Object obj) {
return project.file(obj).toPath();
}
}));
// Convert Provider<Object> to Provider<Path>
this.from.set(from.map(obj -> project.file(obj).toPath()));
}

@Override
Expand Down

0 comments on commit b79d5ec

Please sign in to comment.