Skip to content
This repository has been archived by the owner on Jan 5, 2021. It is now read-only.

Commit

Permalink
Removed execution in stream
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeMathews committed Oct 10, 2018
1 parent 150d8ce commit 9c190e0
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -72,10 +71,14 @@ public BitbakeExtractor(final ExecutableManager executableManager, final Executa
public Extraction extract(final ExtractionId extractionId, final String foundBuildEnvScriptPath, final String sourcePath) {
final String[] packageNames = detectConfiguration.getStringArrayProperty(DetectProperty.DETECT_BITBAKE_PACKAGE_NAMES);

final List<DetectCodeLocation> detectCodeLocations = Arrays.stream(packageNames)
.map(packageName -> executeBitbake(extractionId, foundBuildEnvScriptPath, packageName))
.filter(Optional::isPresent)
.map(bitbakeOutput -> bitbakeOutputTransformer.transformBitbakeOutput(bitbakeOutput.get(), sourcePath))
final List<BitbakeOutput> bitbakeOutputs = new ArrayList<>();
for (final String packageName : packageNames) {
final Optional<BitbakeOutput> bitbakeOutput = executeBitbake(extractionId, foundBuildEnvScriptPath, packageName);
bitbakeOutput.ifPresent(bitbakeOutputs::add);
}

final List<DetectCodeLocation> detectCodeLocations = bitbakeOutputs.stream()
.map(bitbakeOutput -> bitbakeOutputTransformer.transformBitbakeOutput(bitbakeOutput, sourcePath))
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
Expand Down

0 comments on commit 9c190e0

Please sign in to comment.