File: ObjectList.java

package info (click to toggle)
liblayout 0.2.10-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,332 kB
  • sloc: java: 51,125; xml: 138; makefile: 17
file content (65 lines) | stat: -rw-r--r-- 1,755 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package org.jfree.layouting.util;

/**
 * A list of objects that can grow as required.
 * <p>
 * When cloning, the objects in the list are NOT cloned, only the references.
 *
 * @author Thomas Morgner
 */
public class ObjectList extends AbstractObjectList {

    /**
     * Default constructor.
     */
    public ObjectList() {
    }

    /**
     * Creates a new list.
     *
     * @param initialCapacity  the initial capacity.
     */
    public ObjectList(final int initialCapacity) {
        super(initialCapacity);
    }

    // NOTE:  the methods below look redundant, but their purpose is to provide public
    // access to the the get(), set() and indexOf() methods defined in the
    // AbstractObjectList class, for this class only.  For other classes
    // (e.g. PaintList, ShapeList etc) we don't want the Object versions of these
    // methods to be visible in the public API.

    /**
     * Returns the object at the specified index, if there is one, or <code>null</code>.
     *
     * @param index  the object index.
     *
     * @return The object or <code>null</code>.
     */
    public Object get(final int index) {
        return super.get(index);
    }

    /**
     * Sets an object reference (overwriting any existing object).
     *
     * @param index  the object index.
     * @param object  the object (<code>null</code> permitted).
     */
    public void set(final int index, final Object object) {
        super.set(index, object);
    }

    /**
     * Returns the index of the specified object, or -1 if the object is not in the list.
     *
     * @param object  the object.
     *
     * @return The index or -1.
     */
    public int indexOf(final Object object) {
        return super.indexOf(object);
    }

}