/** * Converts the Parameter key/value pairs in a map, and validates * against conflicting duplicates. * Any duplicate will cause to throw a SearchException * @param parameters * @return a new Map instance containing the key/value pairs * @throws org.hibernate.search.exception.SearchException */ public static Map<String, String> toNewMutableMap(Parameter[] parameters) { Map<String, String> map = new LinkedHashMap<>(); if ( parameters != null ) { for ( Parameter param : parameters ) { String previous = map.put( param.name(), param.value() ); if ( previous != null ) { throw log.conflictingParameterDefined( param.name(), param.value(), previous ); } } } return map; }
/** * Converts the Parameter key/value pairs in a map, and validates * against conflicting duplicates. * Any duplicate will cause to throw a SearchException * @param parameters * @return a new Map instance containing the key/value pairs * @throws org.hibernate.search.exception.SearchException */ public static Map<String, String> toNewMutableMap(Parameter[] parameters) { Map<String, String> map = new LinkedHashMap<>(); if ( parameters != null ) { for ( Parameter param : parameters ) { String previous = map.put( param.name(), param.value() ); if ( previous != null ) { throw log.conflictingParameterDefined( param.name(), param.value(), previous ); } } } return map; }