/** * Creates a deep copy of the specified parameter list. That is, copies of all parameters in the specified list are * added to this list. * @param list a parameter list to copy parameters from * @param unmodifiable indicates whether the list should be mutable * @throws URISyntaxException where a parameter in the list specifies an invalid URI value */ public ParameterList(final ParameterList list, final boolean unmodifiable) { final List<Parameter> parameterList = new CopyOnWriteArrayList<Parameter>(); list.forEach(parameter -> { try { parameterList.add(parameter.copy()); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }); if (unmodifiable) { parameters = Collections.unmodifiableList(parameterList); } else { parameters = parameterList; } }
/** * Creates a deep copy of the specified parameter list. That is, copies of all parameters in the specified list are * added to this list. * @param list a parameter list to copy parameters from * @param unmodifiable indicates whether the list should be mutable * @throws URISyntaxException where a parameter in the list specifies an invalid URI value */ public ParameterList(final ParameterList list, final boolean unmodifiable) { final List<Parameter> parameterList = new CopyOnWriteArrayList<Parameter>(); list.forEach(parameter -> { try { parameterList.add(parameter.copy()); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } }); if (unmodifiable) { parameters = Collections.unmodifiableList(parameterList); } else { parameters = parameterList; } }
/** * Creates a new instance indexed on the parameters with the specified name. * @param list a list of properties * @param parameterName the name of parameters on which to index */ public IndexedPropertyList(final PropertyList<Property> list, final String parameterName) { final Map<String, PropertyList<Property>> indexedProperties = new HashMap<String, PropertyList<Property>>(); list.forEach(property -> property.getParameters(parameterName).forEach(parameter -> { PropertyList<Property> properties = indexedProperties.get(parameter.getValue()); if (properties == null) { properties = new PropertyList<Property>(); indexedProperties.put(parameter.getValue(), properties); } properties.add(property); })); this.index = Collections.unmodifiableMap(indexedProperties); }
/** * Creates a new instance indexed on the parameters with the specified name. * @param list a list of properties * @param parameterName the name of parameters on which to index */ public IndexedPropertyList(final PropertyList<Property> list, final String parameterName) { final Map<String, PropertyList<Property>> indexedProperties = new HashMap<String, PropertyList<Property>>(); list.forEach(property -> property.getParameters(parameterName).forEach(parameter -> { PropertyList<Property> properties = indexedProperties.get(parameter.getValue()); if (properties == null) { properties = new PropertyList<Property>(); indexedProperties.put(parameter.getValue(), properties); } properties.add(property); })); this.index = Collections.unmodifiableMap(indexedProperties); }