private List<String> validateProjectSegmentAllocations() {
return flatHistogramStore.getAllProjectAllocationData()
.valuesAsList()
.stream()
.flatMap(List::stream)
.map(this::validateProjectSegmentAllocation) //<- Used here
.filter(Optional::isPresent)
.map(Optional::get)
.collect(Collectors.toList());
}
private Optional<String> validateProjectSegmentAllocation(ProjectSegmentAllocation projectSegmentAllocation) {
ProjectSegmentAllocationData projectSegmentAllocationModel = projectSegmentAllocation.getProjectAllocationModel();
Optional<ProjectSegmentAllocationData> allocationStoreModel = allocationStore.getProjectSegmentAllocationData(projectSegmentAllocationModel.getProjectSegmentAllocationReference());
if (!Optional.of(projectSegmentAllocationModel).equals(allocationStoreModel)) {
return Optional.of("Out of sync");
}
return Optional.empty();
}
--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/328fd66c-a9ac-4cbf-9401-080359e2742c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/328fd66c-a9ac-4cbf-9401-080359e2742c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Starting analysis with configuration:[ baseDir: C:\appname\application workDir: C:\appname\application\.idea\sonarlint extraProperties: {sonar.java.target=1.8, sonar.java.libraries=... sonar.java.source=8, sonar.java.binaries=C:/appname/application/web-client/target/classes, ...} inputFiles: [ C:/appname/application/web-client/src/main/java/de/company/appname/client/utils/ClassName.java ]]
import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Main {
private static final Logger LOGGER = Logger.getLogger(Main.class.getName());
private Main() {
}
public static void main(String[] args) {
new Main().anyMethod();
}
private void anyMethod() {
List<String> list = Arrays.asList("A", "B", "C");
List<String> strings = Stream.of(list, list)
.flatMap(List::stream)
.map(this::usedMethod)
.collect(Collectors.toList());
if(strings.isEmpty())
LOGGER.log(Level.FINE, strings::toString);
}
private String usedMethod(String s) {
return !s.isEmpty() ? "" : "error";
}
}