Top Description Constructors Methods
org.assertj.core.util

public final Class Sets

extends Object
Class Inheritance
Static Imports
java.util.stream.Collectors.toCollection

Utility methods related to Sets.
Author
Alex Ruiz

Constructor Summary

AccessConstructor and Description
private
Sets()

Method Summary

Modifier and TypeMethod and Description
public static <
the generic type of the HashSet to create.
T
>
HashSet<T>

Returns:

the created HashSet.
newHashSet
()

Creates a mutable HashSet.

public static <
the generic type of the HashSet to create.
T
>
HashSet<T>

Returns:

the created HashSet, or null if the given array of elements is null.
newHashSet
(Iterable<? extends T>
the elements to store in the HashSet.
elements
)

Creates a mutable HashSet containing the given elements.

public static <
the generic type of the LinkedHashSet to create.
T
>
LinkedHashSet<T>

Returns:

the created LinkedHashSet.
newLinkedHashSet
()

Creates a mutable LinkedHashSet.

public static <
the generic type of the LinkedHashSet to create.
T
>
LinkedHashSet<T>

Returns:

the created LinkedHashSet, or null if the given array of elements is null.
newLinkedHashSet
(T...
the elements to store in the LinkedHashSet.
elements
)

Creates a mutable LinkedHashSet containing the given elements.

public static <
the generic type of the TreeSet to create.
T
>
TreeSet<T>

Returns:

the created TreeSet.
newTreeSet
()

Creates a mutable TreeSet.

public static <
the generic type of the TreeSet to create.
T
>
TreeSet<T>

Returns:

the created TreeSet, or null if the given array of elements is null.
newTreeSet
(T...
the elements to store in the TreeSet.
elements
)

Creates a mutable TreeSet containing the given elements.

public static <
the generic type of the HashSet to create.
T
>
Set<T>

Returns:

the created HashSet, or null if the given array of elements is null.
set
(T...
the elements to store in the HashSet.
elements
)

Creates a mutable LinkedHashSet containing the given elements.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Setsback to summary
private Sets()

Method Detail

newHashSetback to summary
public static <T> HashSet<T> newHashSet()

Creates a mutable HashSet.

Parameters
<T>
the generic type of the HashSet to create.
Returns:HashSet<T>

the created HashSet.

newHashSetback to summary
public static <T> HashSet<T> newHashSet(Iterable<? extends T> elements)

Creates a mutable HashSet containing the given elements.

Parameters
<T>
the generic type of the HashSet to create.
elements:Iterable<? extends T>

the elements to store in the HashSet.

Returns:HashSet<T>

the created HashSet, or null if the given array of elements is null.

newLinkedHashSetback to summary
public static <T> LinkedHashSet<T> newLinkedHashSet()

Creates a mutable LinkedHashSet.

Parameters
<T>
the generic type of the LinkedHashSet to create.
Returns:LinkedHashSet<T>

the created LinkedHashSet.

newLinkedHashSetback to summary
public static <T> LinkedHashSet<T> newLinkedHashSet(T... elements)

Creates a mutable LinkedHashSet containing the given elements.

Parameters
<T>
the generic type of the LinkedHashSet to create.
elements:T[]

the elements to store in the LinkedHashSet.

Returns:LinkedHashSet<T>

the created LinkedHashSet, or null if the given array of elements is null.

Annotations
@SafeVarargs
newTreeSetback to summary
public static <T> TreeSet<T> newTreeSet()

Creates a mutable TreeSet.

Parameters
<T>
the generic type of the TreeSet to create.
Returns:TreeSet<T>

the created TreeSet.

newTreeSetback to summary
public static <T> TreeSet<T> newTreeSet(T... elements)

Creates a mutable TreeSet containing the given elements.

Parameters
<T>
the generic type of the TreeSet to create.
elements:T[]

the elements to store in the TreeSet.

Returns:TreeSet<T>

the created TreeSet, or null if the given array of elements is null.

Annotations
@SafeVarargs
setback to summary
public static <T> Set<T> set(T... elements)

Creates a mutable LinkedHashSet containing the given elements.

Parameters
<T>
the generic type of the HashSet to create.
elements:T[]

the elements to store in the HashSet.

Returns:Set<T>

the created HashSet, or null if the given array of elements is null.

Annotations
@SafeVarargs