Use utility

This commit is contained in:
Nik Everett 2015-09-23 17:39:43 -04:00
parent aa06433868
commit ffa5b27c75
1 changed files with 2 additions and 5 deletions

View File

@ -64,7 +64,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -76,6 +75,7 @@ import java.util.function.Function;
import static java.util.Collections.emptySet; import static java.util.Collections.emptySet;
import static java.util.Collections.unmodifiableSet; import static java.util.Collections.unmodifiableSet;
import static org.elasticsearch.common.collect.MapBuilder.newMapBuilder; import static org.elasticsearch.common.collect.MapBuilder.newMapBuilder;
import static org.elasticsearch.common.util.set.Sets.newHashSetCopyWith;
/** /**
* *
@ -288,10 +288,7 @@ public class MapperService extends AbstractIndexComponent implements Closeable {
} }
mappers = newMapBuilder(mappers).put(mapper.type(), mapper).map(); mappers = newMapBuilder(mappers).put(mapper.type(), mapper).map();
if (mapper.parentFieldMapper().active()) { if (mapper.parentFieldMapper().active()) {
Set<String> parentTypesCopy = new HashSet<String>(); parentTypes = unmodifiableSet(newHashSetCopyWith(parentTypes, mapper.parentFieldMapper().type()));
parentTypesCopy.addAll(parentTypes);
parentTypesCopy.add(mapper.parentFieldMapper().type());
parentTypes = unmodifiableSet(parentTypesCopy);
} }
assert assertSerialization(mapper); assert assertSerialization(mapper);
return mapper; return mapper;