Blacklist loadList() remove duplicates by using Set

Signed-off-by: Marek Otahal <markotahal@gmail.com>
pull/1/head
Marek Otahal 13 years ago committed by Michael Peter Christen
parent f75b5e40e0
commit f40efb39af

@ -181,6 +181,12 @@ public class Blacklist {
} }
} }
/**
* create a blacklist from file, entries separated by 'sep'
* duplicit entries are removed
* @param blFile
* @param sep
*/
private void loadList(final BlacklistFile blFile, final String sep) { private void loadList(final BlacklistFile blFile, final String sep) {
final Map<String, List<String>> blacklistMapMatch = getBlacklistMap(blFile.getType(), true); final Map<String, List<String>> blacklistMapMatch = getBlacklistMap(blFile.getType(), true);
final Map<String, List<String>> blacklistMapNotMatch = getBlacklistMap(blFile.getType(), false); final Map<String, List<String>> blacklistMapNotMatch = getBlacklistMap(blFile.getType(), false);
@ -213,8 +219,8 @@ public class Blacklist {
blacklistMapNotMatch.put(loadedEntry.getKey(), loadedPaths); blacklistMapNotMatch.put(loadedEntry.getKey(), loadedPaths);
} }
} else { } else {
// TODO check for duplicates? (refactor List -> Set) // check for duplicates? (refactor List -> Set)
paths.addAll(loadedPaths); paths.addAll(new HashSet<String>(loadedPaths));
} }
} }
} }

@ -77,9 +77,9 @@ public class Segment {
public static final int writeBufferSize = 4 * 1024 * 1024; public static final int writeBufferSize = 4 * 1024 * 1024;
// the reference factory // the reference factory
public static final ReferenceFactory<WordReference> wordReferenceFactory = new WordReferenceFactory(); public static final ReferenceFactory<WordReference> wordReferenceFactory = new WordReferenceFactory();
public static final ReferenceFactory<NavigationReference> navigationReferenceFactory = new NavigationReferenceFactory(); public static final ReferenceFactory<NavigationReference> navigationReferenceFactory = new NavigationReferenceFactory();
public static final ByteOrder wordOrder = Base64Order.enhancedCoder; public static final ByteOrder wordOrder = Base64Order.enhancedCoder;
private final Log log; private final Log log;
protected final IndexCell<WordReference> termIndex; protected final IndexCell<WordReference> termIndex;

Loading…
Cancel
Save