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