1 /*
2 * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
89 * contract for the {@code elements} method is that an
90 * {@code Enumeration} is returned that will generate all the elements
91 * contained in entries in this dictionary.
92 *
93 * @return an enumeration of the values in this dictionary.
94 * @see java.util.Dictionary#keys()
95 * @see java.util.Enumeration
96 */
97 public abstract Enumeration<V> elements();
98
99 /**
100 * Returns the value to which the key is mapped in this dictionary.
101 * The general contract for the {@code isEmpty} method is that if this
102 * dictionary contains an entry for the specified key, the associated
103 * value is returned; otherwise, {@code null} is returned.
104 *
105 * @return the value to which the key is mapped in this dictionary;
106 * @param key a key in this dictionary.
107 * {@code null} if the key is not mapped to any value in
108 * this dictionary.
109 * @exception NullPointerException if the {@code key} is {@code null}.
110 * @see java.util.Dictionary#put(java.lang.Object, java.lang.Object)
111 */
112 public abstract V get(Object key);
113
114 /**
115 * Maps the specified {@code key} to the specified
116 * {@code value} in this dictionary. Neither the key nor the
117 * value can be {@code null}.
118 * <p>
119 * If this dictionary already contains an entry for the specified
120 * {@code key}, the value already in this dictionary for that
121 * {@code key} is returned, after modifying the entry to contain the
122 * new element. <p>If this dictionary does not already have an entry
123 * for the specified {@code key}, an entry is created for the
124 * specified {@code key} and {@code value}, and {@code null} is
125 * returned.
126 * <p>
127 * The {@code value} can be retrieved by calling the
128 * {@code get} method with a {@code key} that is equal to
129 * the original {@code key}.
130 *
131 * @param key the hashtable key.
132 * @param value the value.
133 * @return the previous value to which the {@code key} was mapped
134 * in this dictionary, or {@code null} if the key did not
135 * have a previous mapping.
136 * @exception NullPointerException if the {@code key} or
137 * {@code value} is {@code null}.
138 * @see java.lang.Object#equals(java.lang.Object)
139 * @see java.util.Dictionary#get(java.lang.Object)
140 */
141 public abstract V put(K key, V value);
142
143 /**
144 * Removes the {@code key} (and its corresponding
145 * {@code value}) from this dictionary. This method does nothing
146 * if the {@code key} is not in this dictionary.
147 *
148 * @param key the key that needs to be removed.
149 * @return the value to which the {@code key} had been mapped in this
150 * dictionary, or {@code null} if the key did not have a
151 * mapping.
152 * @exception NullPointerException if {@code key} is {@code null}.
153 */
154 public abstract V remove(Object key);
155 }
|
1 /*
2 * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
89 * contract for the {@code elements} method is that an
90 * {@code Enumeration} is returned that will generate all the elements
91 * contained in entries in this dictionary.
92 *
93 * @return an enumeration of the values in this dictionary.
94 * @see java.util.Dictionary#keys()
95 * @see java.util.Enumeration
96 */
97 public abstract Enumeration<V> elements();
98
99 /**
100 * Returns the value to which the key is mapped in this dictionary.
101 * The general contract for the {@code isEmpty} method is that if this
102 * dictionary contains an entry for the specified key, the associated
103 * value is returned; otherwise, {@code null} is returned.
104 *
105 * @return the value to which the key is mapped in this dictionary;
106 * @param key a key in this dictionary.
107 * {@code null} if the key is not mapped to any value in
108 * this dictionary.
109 * @throws NullPointerException if the {@code key} is {@code null}.
110 * @see java.util.Dictionary#put(java.lang.Object, java.lang.Object)
111 */
112 public abstract V get(Object key);
113
114 /**
115 * Maps the specified {@code key} to the specified
116 * {@code value} in this dictionary. Neither the key nor the
117 * value can be {@code null}.
118 * <p>
119 * If this dictionary already contains an entry for the specified
120 * {@code key}, the value already in this dictionary for that
121 * {@code key} is returned, after modifying the entry to contain the
122 * new element. <p>If this dictionary does not already have an entry
123 * for the specified {@code key}, an entry is created for the
124 * specified {@code key} and {@code value}, and {@code null} is
125 * returned.
126 * <p>
127 * The {@code value} can be retrieved by calling the
128 * {@code get} method with a {@code key} that is equal to
129 * the original {@code key}.
130 *
131 * @param key the hashtable key.
132 * @param value the value.
133 * @return the previous value to which the {@code key} was mapped
134 * in this dictionary, or {@code null} if the key did not
135 * have a previous mapping.
136 * @throws NullPointerException if the {@code key} or
137 * {@code value} is {@code null}.
138 * @see java.lang.Object#equals(java.lang.Object)
139 * @see java.util.Dictionary#get(java.lang.Object)
140 */
141 public abstract V put(K key, V value);
142
143 /**
144 * Removes the {@code key} (and its corresponding
145 * {@code value}) from this dictionary. This method does nothing
146 * if the {@code key} is not in this dictionary.
147 *
148 * @param key the key that needs to be removed.
149 * @return the value to which the {@code key} had been mapped in this
150 * dictionary, or {@code null} if the key did not have a
151 * mapping.
152 * @throws NullPointerException if {@code key} is {@code null}.
153 */
154 public abstract V remove(Object key);
155 }
|