1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.collections15;
17
18 import java.util.Collection;
19
20 /***
21 * Defines a collection that allows objects to be removed in some well-defined
22 * 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 *
38 * @since Commons Collections 2.1
39 * @version $Revision: 1.1 $ $Date: 2005/03/19 07:13:35 $
40 *
41 * @author Avalon
42 * @author Berin Loritsch
43 * @author Paul Jack
44 * @author Stephen Colebourne
45 * @author Mauro Franceschini (port to 5.0)
46 */
47 public interface Buffer<E> extends Collection<E> {
48
49 /***
50 * Gets and removes the next object from the buffer.
51 *
52 * @return the next object in the buffer, which is also removed
53 * @throws BufferUnderflowException if the buffer is already empty
54 */
55 E remove();
56
57 /***
58 * Gets the next object from the buffer without removing it.
59 *
60 * @return the next object in the buffer, which is not removed
61 * @throws BufferUnderflowException if the buffer is empty
62 */
63 E get();
64
65 }