public class MyHashSet
extends java.lang.Object
Constructor and Description |
---|
MyHashSet() |
Modifier and Type | Method and Description |
---|---|
static <E> java.util.Set<E> |
createSet(E... e)
Creates a HashSet from a given collection of objects
|
static <E> java.util.Set<E> |
validateDistinctAndCreateSet(E... e)
Creates a HashSet from a given collection of objects, if and only if the given collection contains no duplicates
|
@SafeVarargs public static <E> java.util.Set<E> createSet(E... e)
E
- the element typee
- a collection of objects to be collected in a HashSet@SafeVarargs public static <E> java.util.Set<E> validateDistinctAndCreateSet(E... e) throws DuplicateException
E
- the element typee
- a collection of objects to be collected in a HashSetDuplicateException
- if a duplicate is contained in the given collection