/** * Converts a map of language keys to lists of {@link MonolingualTextValue} * objects to a flat list of such objects, as required for the factory * methods, where the values in the flat lists are new copies of the * original values. * * @param aliasMap * the map to convert * @return the flattened list with copied values */ private List<MonolingualTextValue> copyAliasMap( Map<String, List<MonolingualTextValue>> aliasMap) { List<MonolingualTextValue> aliases = new ArrayList<>(); for (Entry<String, List<MonolingualTextValue>> langAliases : aliasMap.entrySet()) { if (filter.includeLanguage(langAliases.getKey())) { for (MonolingualTextValue mtv : langAliases.getValue()) { aliases.add(copy(mtv)); } } } return aliases; }
/** * Converts a map of language keys to lists of {@link MonolingualTextValue} * objects to a flat list of such objects, as required for the factory * methods, where the values in the flat lists are new copies of the * original values. * * @param aliasMap * the map to convert * @return the flattened list with copied values */ private List<MonolingualTextValue> copyAliasMap( Map<String, List<MonolingualTextValue>> aliasMap) { List<MonolingualTextValue> aliases = new ArrayList<>(); for (Entry<String, List<MonolingualTextValue>> langAliases : aliasMap.entrySet()) { if (filter.includeLanguage(langAliases.getKey())) { for (MonolingualTextValue mtv : langAliases.getValue()) { aliases.add(copy(mtv)); } } } return aliases; }
/** * Copies a collection of {@link MonolingualTextValue} objects * * @param monoLingualTextValues * object to copy * @return the copied object */ private List<MonolingualTextValue> copyMonoLingualTextValues(Collection<MonolingualTextValue> monoLingualTextValues) { if (filter.excludeAllLanguages()) { return Collections.emptyList(); } List<MonolingualTextValue> result = new ArrayList<>(monoLingualTextValues.size()); for (MonolingualTextValue mtv : monoLingualTextValues) { if (filter.includeLanguage(mtv.getLanguageCode())) { result.add(copy(mtv)); } } return result; }
/** * Copies a collection of {@link MonolingualTextValue} objects * * @param monoLingualTextValues * object to copy * @return the copied object */ private List<MonolingualTextValue> copyMonoLingualTextValues(Collection<MonolingualTextValue> monoLingualTextValues) { if (filter.excludeAllLanguages()) { return Collections.emptyList(); } List<MonolingualTextValue> result = new ArrayList<>(monoLingualTextValues.size()); for (MonolingualTextValue mtv : monoLingualTextValues) { if (filter.includeLanguage(mtv.getLanguageCode())) { result.add(copy(mtv)); } } return result; }