private FileTypeAssocTable(Map<CharSequence, T> extensionMappings, Map<CharSequence, T> exactFileNameMappings, Map<CharSequence, T> exactFileNameAnyCaseMappings, List<Pair<FileNameMatcher, T>> matchingMappings) { myExtensionMappings = new THashMap<CharSequence, T>(extensionMappings, CharSequenceHashingStrategy.CASE_INSENSITIVE); myExactFileNameMappings = new THashMap<CharSequence, T>(exactFileNameMappings, CharSequenceHashingStrategy.CASE_SENSITIVE); myExactFileNameAnyCaseMappings = new THashMap<CharSequence, T>(exactFileNameAnyCaseMappings, CharSequenceHashingStrategy.CASE_INSENSITIVE) { @Override public T remove(Object key) { T removed = super.remove(key); myHasAnyCaseExactMappings = size() > 0; return removed; } @Override public T put(CharSequence key, T value) { T result = super.put(key, value); myHasAnyCaseExactMappings = true; return result; } }; myMatchingMappings = new ArrayList<Pair<FileNameMatcher, T>>(matchingMappings); }
private FileTypeAssocTable(@NotNull Map<CharSequence, T> extensionMappings, @NotNull Map<CharSequence, T> exactFileNameMappings, @NotNull Map<CharSequence, T> exactFileNameAnyCaseMappings, @NotNull List<Pair<FileNameMatcher, T>> matchingMappings) { myExtensionMappings = new THashMap<CharSequence, T>(Math.max(10, extensionMappings.size()), 0.5f, CharSequenceHashingStrategy.CASE_INSENSITIVE); myExtensionMappings.putAll(extensionMappings); myExactFileNameMappings = new THashMap<CharSequence, T>(Math.max(10, exactFileNameMappings.size()), 0.5f, CharSequenceHashingStrategy.CASE_SENSITIVE); myExactFileNameMappings.putAll(exactFileNameMappings); myExactFileNameAnyCaseMappings = new THashMap<CharSequence, T>(Math.max(10, exactFileNameAnyCaseMappings.size()), 0.5f, CharSequenceHashingStrategy.CASE_INSENSITIVE); myExactFileNameAnyCaseMappings.putAll(exactFileNameAnyCaseMappings); myMatchingMappings = new ArrayList<Pair<FileNameMatcher, T>>(matchingMappings); }