package de.retest.recheck.ignore;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SearchFilterFiles {

	private static final String PATH_FILTER_FILES = "filter/web/";
	private static final List<String> DEFAULT_FILTER_FILES = Arrays.asList( "positioning.filter", "visibility.filter" );

	private SearchFilterFiles() {}

	public static List<File> getDefaultFilterFiles() {
		final List<File> solution = new ArrayList<>();
		for ( final String filterName : DEFAULT_FILTER_FILES ) {
			final URL resource = SearchFilterFiles.class.getClassLoader().getResource( PATH_FILTER_FILES + filterName );
			if ( resource == null ) {
				log.debug( "The search for {} was unsuccessful, make sure that the file was not deleted.", filterName );
			} else {
				final File filterFile = new File( resource.getFile() );
				solution.add( filterFile );
			}
		}
		return solution;
	}

}

@@ -65,15 +65,19 @@
 ava.
-net.URL
+util.Arrays
 ;%0Aim
@@ -91,21 +91,16 @@
 va.util.
-Array
 List;%0Aim
@@ -106,37 +106,38 @@
 mport java.util.
-Array
+Object
 s;%0Aimport java.u
@@ -144,56 +144,27 @@
 til.
-List;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0A%0A@Slf4j
+stream.Collectors;%0A
 %0Apub
@@ -223,28 +223,29 @@
  String 
-PATH
+BASIC
 _FILTER_
 FILES = 
@@ -240,28 +240,23 @@
 TER_
-FILES
+DIR
  = %22
+/
 filter/
-web/
 %22;%0A%09
@@ -280,58 +280,147 @@
 nal 
-List%3C
 String
-%3E DEFAULT_FILTER_FILES = Arrays.asList(
+ WEB_FILTER_DIR = BASIC_FILTER_DIR + %22web/%22;%0A%09private static final List%3CString%3E defaultWebFilter =%0A%09%09%09Arrays.asList( WEB_FILTER_DIR +
  %22po
@@ -437,16 +437,33 @@
 filter%22,
+ WEB_FILTER_DIR +
  %22visibi
@@ -570,495 +570,247 @@
 %7B%0A%09%09
-final List%3CFile%3E solution = new ArrayList%3C%3E();%0A%09%09for ( final String filterName : DEFAULT_FILTER_FILES ) %7B%0A%09%09%09final URL resource = SearchFilterFiles.class.getClassLoader().getResource( PATH_FILTER_FILES + filterName );%0A%09%09%09if ( resource == null ) %7B
+return defaultWebFilter.stream() //%0A%09%09%09%09.map( filter -%3E SearchFilterFiles.class.getResource( filter ) ) //
 %0A%09%09%09%09
-log.debug( %22The search for %7B%7D was unsuccessful, make sure that the file was not deleted.%22, filterName );%0A%09%09%09%7D else %7B%0A%09%09%09%09final File filterFile = new File( resource.getFile() );%0A%09%09%09%09solution.add( filterFile );%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return solution;
+.filter( Objects::nonNull ) //%0A%09%09%09%09.map( resource -%3E new File( resource.getFile() ) ) //%0A%09%09%09%09.collect( Collectors.toList() ); //
 %0A%09%7D%0A

Simplify impl