Package org.apache.juneau.internal
Class MapBuilder<K,V> 
java.lang.Object
org.apache.juneau.internal.MapBuilder<K,V> 
- Type Parameters:
- K- Key type.
- V- Value type.
Builder for maps.
 
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionMapBuilder<K,V> Adds a single entry to this map.MapBuilder<K,V> Appends the contents of the specified map into this map.MapBuilder<K,V> Adds arbitrary values to this list.MapBuilder<K,V> Adds entries to this list via JSON object strings.MapBuilder<K,V> Adds a list of key/value pairs to this map.build()Builds the map.MapBuilder<K,V> copy()Forces the existing set to be copied instead of appended to.MapBuilder<K,V> sorted()Converts the set into aSortedMap.MapBuilder<K,V> sorted(Comparator<K> comparator) Converts the set into aSortedMapusing the specified comparator.MapBuilder<K,V> sparse()When specified, thebuild()method will returnnull if the map is empty.MapBuilder<K,V> When specified,build()will return an unmodifiable map.
- 
Constructor Details- 
MapBuilderConstructor.- Parameters:
- keyType- The key type.
- valueType- The value type.
- valueTypeArgs- The value type generic arguments if there are any.
 
- 
MapBuilderConstructor.- Parameters:
- addTo- The map to add to.
 
 
- 
- 
Method Details- 
buildBuilds the map.- Returns:
- A map conforming to the settings on this builder.
 
- 
sparseWhen specified, thebuild()method will returnnull if the map is empty.Otherwise build()will never returnnull .- Returns:
- This object.
 
- 
unmodifiableWhen specified,build()will return an unmodifiable map.- Returns:
- This object.
 
- 
copyForces the existing set to be copied instead of appended to.- Returns:
- This object.
 
- 
sortedConverts the set into aSortedMap.- Returns:
- This object.
 
- 
sortedConverts the set into aSortedMapusing the specified comparator.- Parameters:
- comparator- The comparator to use for sorting.
- Returns:
- This object.
 
- 
addAllAppends the contents of the specified map into this map.This is a no-op if the value is null .- Parameters:
- value- The map to add to this map.
- Returns:
- This object.
 
- 
addAdds a single entry to this map.- Parameters:
- key- The map key.
- value- The map value.
- Returns:
- This object.
 
- 
addJsonAdds entries to this list via JSON object strings.- Parameters:
- values- The JSON object strings to parse and add to this list.
- Returns:
- This object.
 
- 
addAnyAdds arbitrary values to this list.Objects can be any of the following: - Maps of key/value types convertible to the key/value types of this map.
- JSON object strings parsed and convertible to the key/value types of this map.
 - Parameters:
- values- The values to add.
- Returns:
- This object.
 
- 
addPairsAdds a list of key/value pairs to this map.- Parameters:
- pairs- The pairs to add.
- Returns:
- This object.
 
 
-