T - The type of the set’s elementspublic class SetBuilder<T> extends Object
Sets in a single command without
extending an existing Set class.| Constructor and Description |
|---|
SetBuilder()
|
SetBuilder(Set<T> set)
Creates a new set builder that will populate the given set and return it
on
get(). |
| Modifier and Type | Method and Description |
|---|---|
SetBuilder<T> |
add(T element)
Adds the given element to the set.
|
SetBuilder<T> |
addAll(Collection<? extends T> elements)
Adds all elements from the given collection to the set.
|
Set<T> |
get()
Returns the populated set.
|
public SetBuilder<T> add(T element)
element - The element to addpublic SetBuilder<T> addAll(Collection<? extends T> elements)
elements - The elements to addCopyright © 2026. All rights reserved.