KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > Buffer


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections;
17
18 import java.util.Collection JavaDoc;
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  *
37  * @since Commons Collections 2.1
38  * @version $Revision: 1.10 $ $Date: 2004/02/18 01:15:42 $
39  *
40  * @author Avalon
41  * @author Berin Loritsch
42  * @author Paul Jack
43  * @author Stephen Colebourne
44  */

45 public interface Buffer extends Collection JavaDoc {
46
47     /**
48      * Gets and removes the next object from the buffer.
49      *
50      * @return the next object in the buffer, which is also removed
51      * @throws BufferUnderflowException if the buffer is already empty
52      */

53     Object JavaDoc remove();
54
55     /**
56      * Gets the next object from the buffer without removing it.
57      *
58      * @return the next object in the buffer, which is not removed
59      * @throws BufferUnderflowException if the buffer is empty
60      */

61     Object JavaDoc get();
62
63 }
64
Popular Tags