1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.collections;
17
18 import java.util.Collection;
19
20 /**
21 * Defines a collection that allows objects to be removed in some well-defined order.
22 * <p>
23 * The removal order can be based on insertion order (eg, a FIFO queue or a
24 * LIFO stack), on access order (eg, an LRU cache), on some arbitrary comparator
25 * (eg, a priority queue) or on any other well-defined ordering.
26 * <p>
27 * Note that the removal order is not necessarily the same as the iteration
28 * order. A <code>Buffer</code> implementation may have equivalent removal
29 * and iteration orders, but this is not required.
30 * <p>
31 * This interface does not specify any behavior for
32 * {@link Object#equals(Object)} and {@link Object#hashCode} methods. It
33 * is therefore possible for a <code>Buffer</code> implementation to also
34 * also implement {@link java.util.List}, {@link java.util.Set} or
35 * {@link Bag}.
36 * <p>
37 * <strong>Note:</strong> this class should be bytecode-identical to the
38 * version in commons collections. This is required to allow backwards
39 * compability with both previous versions of BeanUtils and also allow
40 * coexistance with both collections 2.1 and 3.0.
41 *
42 * @since Commons Collections 2.1
43 * @version $Revision: 1.1 $ $Date: 2004/05/10 19:50:28 $
44 *
45 * @author Avalon
46 * @author Berin Loritsch
47 * @author Paul Jack
48 * @author Stephen Colebourne
49 */
50 public interface Buffer extends Collection {
51
52 /**
53 * Gets and removes the next object from the buffer.
54 *
55 * @return the next object in the buffer, which is also removed
56 * @throws BufferUnderflowException if the buffer is already empty
57 */
58 Object remove();
59
60 /**
61 * Gets the next object from the buffer without removing it.
62 *
63 * @return the next object in the buffer, which is not removed
64 * @throws BufferUnderflowException if the buffer is empty
65 */
66 Object get();
67
68 }