1/*
2 * Copyright (c) 2007 Mockito contributors
3 * This program is made available under the terms of the MIT License.
4 */
5package org.mockito.internal.util.collections;
6
7import java.util.LinkedHashSet;
8import java.util.Set;
9
10import static java.util.Arrays.asList;
11
12public abstract class Sets {
13    public static Set<Object> newMockSafeHashSet(Iterable<Object> mocks) {
14        return HashCodeAndEqualsSafeSet.of(mocks);
15    }
16
17    public static Set<Object> newMockSafeHashSet(Object... mocks) {
18        return HashCodeAndEqualsSafeSet.of(mocks);
19    }
20
21    public static IdentitySet newIdentitySet() {
22        return new IdentitySet();
23    }
24
25    public static <T> Set<T> newSet(T ... elements) {
26        if (elements == null) {
27            throw new IllegalArgumentException("Expected an array of elements (or empty array) but received a null.");
28        }
29        return new LinkedHashSet<T>(asList(elements));
30    }
31}
32