OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
182 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.utils.cc;
15
 
16
import java.util.ArrayList;
17
import java.util.Collection;
18
 
19
/**
20
 * This class implements the <tt>Set</tt> interface with a list, using reference-equality in place
21
 * of object-equality when comparing items.
22
 *
23
 * @param <E> the type of elements maintained by this set
24
 */
25
public final class ArrayIdentitySet<E> extends ListIdentitySet<E> implements Cloneable {
26
 
27
    public ArrayIdentitySet() {
28
        super();
29
    }
30
 
31
    public ArrayIdentitySet(int expectedMaxSize) {
32
        super(expectedMaxSize);
33
    }
34
 
35
    public ArrayIdentitySet(Collection<? extends E> c) {
36
        super(c);
37
    }
38
 
39
    @Override
40
    protected ArrayList<E> newList(int expectedSize) {
41
        return new ArrayList<>(expectedSize);
42
    }
43
 
44
    /**
45
     * Returns a shallow copy of this instance: the elements themselves are not cloned.
46
     *
47
     * @return a shallow copy of this set
48
     */
49
    @Override
50
    public Object clone() {
51
        return new ArrayIdentitySet<E>(this);
52
    }
53
}