KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > util > collection > Bucket


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 //NOTE: Tabs are used instead of spaces for indentation.
25
// Make sure that your editor does not replace tabs with spaces.
26
// Set the tab length using your favourite editor to your
27
// visual preference.
28

29 /*
30  * Filename: Bucket.java
31  *
32  * Copyright 2000-2001 by iPlanet/Sun Microsystems, Inc.,
33  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
34  * All rights reserved.
35  *
36  * This software is the confidential and proprietary information
37  * of iPlanet/Sun Microsystems, Inc. ("Confidential Information").
38  * You shall not disclose such Confidential Information and shall
39  * use it only in accordance with the terms of the license
40  * agreement you entered into with iPlanet/Sun Microsystems.
41  */

42  
43 /**
44  * <BR> <I>$Source: /cvs/glassfish/appserv-commons/src/java/com/sun/enterprise/util/collection/Bucket.java,v $</I>
45  * @author $Author: tcfujii $
46  * @version $Revision: 1.3 $ $Date: 2005/12/25 04:12:10 $
47  */

48  
49 package com.sun.enterprise.util.collection;
50
51 import java.util.Iterator JavaDoc;
52     
53 /**
54  * A bucket is esentially a list of entries that can be accessed through a primitive typed key.
55  * Buckets are used in building primitive typed HashMaps. See IntHashMap for more details.
56  *
57  */

58 public interface Bucket {
59     
60     /**
61      * Put an object into the bucket using the key. The key can be used
62      * to retrieve the object later.
63      * @param key The key (can be negative).
64      * @param object The object to be put in the bucket.
65      * @return Any old object that was associated using the same key or null otherwise.
66      */

67     public Object JavaDoc put(int key, Object JavaDoc object);
68     public Object JavaDoc put(long key, Object JavaDoc object);
69     
70     /**
71      * Get an object into the bucket using the key.
72      * @param key The key (can be negative) for retrieving object.
73      * @return The object that was associated using the same key or null otherwise.
74      */

75     public Object JavaDoc get(int key);
76     public Object JavaDoc get(long key);
77     
78     /**
79      * Remove an object from the bucket using the key.
80      * @param key The key (can be negative).
81      * @return The object that was associated using the same key or null otherwise.
82      */

83     public Object JavaDoc remove(int key);
84     public Object JavaDoc remove(long key);
85     
86     /**
87      * Check if the bucket contains the key.
88      * @param key The key (can be negative).
89      * @return true if the bucket contains the key or null otherwise.
90      */

91     public boolean containsKey(int key);
92     public boolean containsKey(long key);
93     
94     
95     /**
96      * Return the size of the bucket.
97      * @return The number of items in the bucket
98      */

99     public int size();
100     
101     /**
102      * Get an iterator for iteraing through all objects in the bucket.
103      * @return An iterator. iterator.next() returns an object.
104      */

105     public Iterator JavaDoc iterator();
106     
107     /**
108      * Get an iterator for iteraing through all entries in the bucket.
109      * @return An iterator. iterator.next() returns an IntEntry.
110      */

111     public Iterator JavaDoc entryIterator();
112     
113 }
114
Popular Tags