package de.retest.recheck.review.workers;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Optional;
import java.util.stream.Collectors;

import de.retest.recheck.ignore.JSShouldIgnoreImpl;
import de.retest.recheck.ignore.RecheckIgnoreUtil;
import de.retest.recheck.ignore.ShouldIgnore;
import de.retest.recheck.review.GlobalIgnoreApplier;
import de.retest.recheck.review.GlobalIgnoreApplier.PersistableGlobalIgnoreApplier;
import de.retest.recheck.review.counter.Counter;
import de.retest.recheck.review.ignore.io.Loaders;

public class LoadShouldIgnoreWorker {

	private final Counter counter;

	public LoadShouldIgnoreWorker( final Counter counter ) {
		this.counter = counter;
	}

	public GlobalIgnoreApplier load() throws IOException {
		final Optional<Path> path = RecheckIgnoreUtil.getIgnoreFile();
		final PersistableGlobalIgnoreApplier ignoreApplier = Loaders
				.load( Files.lines(
						path.orElseThrow( () -> new IllegalArgumentException( "No reliable argument found." ) ) ) ) //
				.filter( ShouldIgnore.class::isInstance ) //
				.map( ShouldIgnore.class::cast ) //
				.collect( Collectors.collectingAndThen( Collectors.toList(), PersistableGlobalIgnoreApplier::new ) );
		final GlobalIgnoreApplier result = GlobalIgnoreApplier.create( counter, ignoreApplier );

		final Optional<Path> ignoreRuleFile = RecheckIgnoreUtil.getIgnoreRuleFile();
		if ( ignoreRuleFile.isPresent() ) {
			result.add( new JSShouldIgnoreImpl( ignoreRuleFile.get() ) );
		}

		return result;
	}

	public Counter getCounter() {
		return counter;
	}
}

@@ -1332,126 +1332,65 @@
 %0A%0A%09%09
-final Optional%3CPath%3E ignoreRuleFile = RecheckIgnoreUtil.getIgnoreRuleFile();%0A%09%09if ( ignoreRuleFile.isPresent() ) %7B%0A%09%09%09
+RecheckIgnoreUtil.getIgnoreRuleFile().ifPresent( file -%3E 
 resu
@@ -1425,37 +1425,19 @@
 pl( 
-ignoreRuleFile.get(
+file 
 ) ) );
-%0A%09%09%7D
 %0A%0A%09%09

Use isPresent lamda instead of if check