Package org.apache.juneau.internal
Class SetBuilder<E>
java.lang.Object
org.apache.juneau.internal.SetBuilder<E>
- Type Parameters:
- E- Element type.
Builder for sets.
 
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionSetBuilder(Class<E> elementType, Type... elementTypeArgs) Constructor.SetBuilder(Set<E> addTo) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionAdds a single value to this set.Adds multiple values to this set.addAll(Collection<E> value) Appends the contents of the specified collection into this set.Adds arbitrary values to this set.Adds a value to this set if the specified flag is true.Adds entries to this set via JSON array strings.build()Builds the set.copy()Forces the existing set to be copied instead of appended to.elementType(Class<E> value) Specifies the element type on this list.sorted()Converts the set into aSortedSet.sorted(Comparator<E> comparator) Converts the set into aSortedSetusing the specified comparator.sparse()When specified, thebuild()method will returnnull if the set is empty.When specified,build()will return an unmodifiable set.
- 
Constructor Details- 
SetBuilderConstructor.- Parameters:
- elementType- The element type.
- elementTypeArgs- The element type generic arguments if there are any.
 
- 
SetBuilderConstructor.- Parameters:
- addTo- The set to add to.
 
 
- 
- 
Method Details- 
elementTypeSpecifies the element type on this list.- Parameters:
- value- The element type.
- Returns:
- This object.
 
- 
buildBuilds the set.- Returns:
- A set conforming to the settings on this builder.
 
- 
sparseWhen specified, thebuild()method will returnnull if the set is empty.Otherwise build()will never returnnull .- Returns:
- This object.
 
- 
unmodifiableWhen specified,build()will return an unmodifiable set.- Returns:
- This object.
 
- 
copyForces the existing set to be copied instead of appended to.- Returns:
- This object.
 
- 
sortedConverts the set into aSortedSet.- Returns:
- This object.
 
- 
sortedConverts the set into aSortedSetusing the specified comparator.- Parameters:
- comparator- The comparator to use for sorting.
- Returns:
- This object.
 
- 
addAllAppends the contents of the specified collection into this set.This is a no-op if the value is null .- Parameters:
- value- The collection to add to this set.
- Returns:
- This object.
 
- 
addAdds a single value to this set.- Parameters:
- value- The value to add to this set.
- Returns:
- This object.
 
- 
addAdds multiple values to this set.- Parameters:
- values- The values to add to this set.
- Returns:
- This object.
 
- 
addJsonAdds entries to this set via JSON array strings.- Parameters:
- values- The JSON array strings to parse and add to this set.
- Returns:
- This object.
 
- 
addAnyAdds arbitrary values to this set.Objects can be any of the following: - The same type or convertible to the element type of this set.
- Collections or arrays of anything on this set.
- JSON array strings parsed and convertible to the element type of this set.
 - Parameters:
- values- The values to add.
- Returns:
- This object.
 
- 
addIfAdds a value to this set if the specified flag is true.- Parameters:
- flag- The flag.
- value- The value.
- Returns:
- This object.
 
 
-