- Dictionary classes in java
- Constructor Summary
- Method Summary
- Methods inherited from class java.lang.Object
- Constructor Detail
- Dictionary
- Method Detail
- size
- isEmpty
- keys
- elements
- get
- put
- remove
- Dictionary classes in java
- Learn Latest Tutorials
- Preparation
- Trending Technologies
- B.Tech / MCA
- Javatpoint Services
- Training For College Campus
- Dictionary classes in java
- Constructor Summary
- Method Summary
- Methods declared in class java.lang.Object
- Constructor Detail
- Dictionary
- Method Detail
- size
- isEmpty
- keys
- elements
- get
- put
- remove
- Constructor Summary
- Method Summary
- Methods declared in class java.lang.Object
- Constructor Details
- Dictionary
- Method Details
- size
- isEmpty
- keys
- elements
- get
- put
- remove
Dictionary classes in java
The Dictionary class is the abstract parent of any class, such as Hashtable , which maps keys to values. Every key and every value is an object. In any one Dictionary object, every key is associated with at most one value. Given a Dictionary and a key, the associated element can be looked up. Any non- null object can be used as a key and as a value. As a rule, the equals method should be used by implementations of this class to decide if two keys are the same. NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class.
Constructor Summary
Method Summary
Methods inherited from class java.lang.Object
Constructor Detail
Dictionary
Method Detail
size
isEmpty
public abstract boolean isEmpty()
Tests if this dictionary maps no keys to value. The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.
keys
Returns an enumeration of the keys in this dictionary. The general contract for the keys method is that an Enumeration object is returned that will generate all the keys for which this dictionary contains entries.
elements
Returns an enumeration of the values in this dictionary. The general contract for the elements method is that an Enumeration is returned that will generate all the elements contained in entries in this dictionary.
get
Returns the value to which the key is mapped in this dictionary. The general contract for the isEmpty method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise, null is returned.
put
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null . If this dictionary already contains an entry for the specified key, the value already in this dictionary for that key is returned, after modifying the entry to contain the new element. If this dictionary does not already have an entry for the specified key, an entry is created for the specified key and value, and null is returned. The value can be retrieved by calling the get method with a key that is equal to the original key .
remove
Removes the key (and its corresponding value ) from this dictionary. This method does nothing if the key is not in this dictionary.
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
Dictionary classes in java
Learn Latest Tutorials
Preparation
Trending Technologies
B.Tech / MCA
Javatpoint Services
JavaTpoint offers too many high quality services. Mail us on h[email protected], to get more information about given services.
- Website Designing
- Website Development
- Java Development
- PHP Development
- WordPress
- Graphic Designing
- Logo
- Digital Marketing
- On Page and Off Page SEO
- PPC
- Content Development
- Corporate Training
- Classroom and Online Training
- Data Entry
Training For College Campus
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week
Like/Subscribe us for latest updates or newsletter
Dictionary classes in java
The Dictionary class is the abstract parent of any class, such as Hashtable , which maps keys to values. Every key and every value is an object. In any one Dictionary object, every key is associated with at most one value. Given a Dictionary and a key, the associated element can be looked up. Any non- null object can be used as a key and as a value. As a rule, the equals method should be used by implementations of this class to decide if two keys are the same. NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class.
Constructor Summary
Method Summary
Methods declared in class java.lang.Object
Constructor Detail
Dictionary
Method Detail
size
isEmpty
public abstract boolean isEmpty()
Tests if this dictionary maps no keys to value. The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.
keys
Returns an enumeration of the keys in this dictionary. The general contract for the keys method is that an Enumeration object is returned that will generate all the keys for which this dictionary contains entries.
elements
Returns an enumeration of the values in this dictionary. The general contract for the elements method is that an Enumeration is returned that will generate all the elements contained in entries in this dictionary.
get
Returns the value to which the key is mapped in this dictionary. The general contract for the isEmpty method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise, null is returned.
put
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null . If this dictionary already contains an entry for the specified key , the value already in this dictionary for that key is returned, after modifying the entry to contain the new element. If this dictionary does not already have an entry for the specified key , an entry is created for the specified key and value , and null is returned. The value can be retrieved by calling the get method with a key that is equal to the original key .
remove
Removes the key (and its corresponding value ) from this dictionary. This method does nothing if the key is not in this dictionary.
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.
Class Dictionary
The Dictionary class is the abstract parent of any class, such as Hashtable , which maps keys to values. Every key and every value is an object. In any one Dictionary object, every key is associated with at most one value. Given a Dictionary and a key, the associated element can be looked up. Any non- null object can be used as a key and as a value.
As a rule, the equals method should be used by implementations of this class to decide if two keys are the same.
NOTE: This class is obsolete. New implementations should implement the Map interface, rather than extending this class.
Constructor Summary
Method Summary
Methods declared in class java.lang.Object
Constructor Details
Dictionary
Method Details
size
isEmpty
Tests if this dictionary maps no keys to value. The general contract for the isEmpty method is that the result is true if and only if this dictionary contains no entries.
keys
Returns an enumeration of the keys in this dictionary. The general contract for the keys method is that an Enumeration object is returned that will generate all the keys for which this dictionary contains entries.
elements
Returns an enumeration of the values in this dictionary. The general contract for the elements method is that an Enumeration is returned that will generate all the elements contained in entries in this dictionary.
get
Returns the value to which the key is mapped in this dictionary. The general contract for the isEmpty method is that if this dictionary contains an entry for the specified key, the associated value is returned; otherwise, null is returned.
put
Maps the specified key to the specified value in this dictionary. Neither the key nor the value can be null . If this dictionary already contains an entry for the specified key , the value already in this dictionary for that key is returned, after modifying the entry to contain the new element. If this dictionary does not already have an entry for the specified key , an entry is created for the specified key and value , and null is returned. The value can be retrieved by calling the get method with a key that is equal to the original key .
remove
Removes the key (and its corresponding value ) from this dictionary. This method does nothing if the key is not in this dictionary.
Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.