IT Hardwares

eg: UK or Brides UK or Classical Art or Buy Music or Spirituality
 
eg: UK or Brides UK or Classical Art or Buy Music or Spirituality
 
Business & Money
Technology
Women
Health
Education
Family
Travel
Cars
Entertainment
SD Editorials
Online Guide and article directory site.
Foodeditorials.com
Over 15,000 recipes & editorials on food.
Lyricadvisor.com
Get 100,000 Lyric & Albums.

Video on Hashtable

    View: 
Similar Videos
Currently No Video Available
 
Hashtable
Rahim Vindhani
Map interface does not implement Collection interface, because it does not contain elements but contains entries of keys and their corresponding values (i.e. called mapping).
Map does not allow duplicate keys. So there is utmost one value that is mapped with the given key.
Both key and value must be an Object (Primitive values must be wrapped).
Hashtable implements Map interface (As of the Java 2 platform v1.2, this class has been retrofitted to implement Map, so that it becomes a part of Java's collection framework).
Hashtables will automatically grow when you add too many elements. However, growing requires copying, rehashing and rechaining, which affects its overall performance.
Performance of Hashtable depends on two important factors that are
• Initial Capacity and
• Load Factor
Initial Capacity is the capacity at the time the hash table is created. Load factor determines when to increase the capacity of the Hashtable. The default load factor is 0.75.
Important Note: The initial capacity is not the actual number of elements you plan to store in hashtable. Say for example, if you set initial capacity of 100 and the load factor is 0.75, then the capacity of Hashtable will be automatically increased when it reaches to 75 not 100.
Constructors
Hashtable ()
Constructs empty hashtable with a default initial capacity 11 and load factor 0.75.
Hashtable (int initialCapacity)
Constructs empty hashtable with the specified initial capacity and default load factor 0.75.
Hashtable (int initialCapacity, float loadFactor)
Constructs empty hashtable with the specified initial capacity and the specified load factor.
Hashtable (Map t)
Constructs a new hashtable with the mappings same as the passed Map.
Basic methods
Object get (Object key)
Returns the value mapped to the specified key, or null if no entry is found.
Object put (Object key, Object value)
Maps the specified key to the specified value in this hashtable and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value.
Object remove (Object key)
Removes the key and its associated value from the hashtable, and returns the value previously associated with the specified key, if any. Otherwise, it returns the null value.
boolean containsKey(Object key)
Returns true if the specified key is mapped to some value in the map, otherwise false.
boolean containsValue(Object value)
Returns true if there are one or more keys mapped to the specified value, otherwise false.
int size()
Returns the size of the hashtable.
boolean isEmpty()
returns true if hashtable is empty, otherwise false.
Other methods
void putAll(Map t)
copies all mappings from the map to current hashtable and replaces existing entries, if any.
Void clear()
Removes all mappings from hashtable.
Collection values()
Returns collection of the values contained in the hashtable.
Enumeration elements()
Return Enumeration of the values contained in the hashtable.
Set entrySet()
Returns a Set of entries contained in the Hashtable.
Enumeration keys()
Return Enumeration of keys contained in the hashtable.
Object clone()
Creates copy of the hashtable.
Note : hashtable may throw IllegalArgumentException, if any unsupported operation is invoked.
Next Paragraph..
A Guide to Business | Guide to Technology | Guide to Women | Guide to Health | Family Guide to | Travel & Vacations | Information on Cars

EditorialToday IT Hardwares has 2 sub sections. Such as Computer Guide and Hardware. With over 20,000 authors and writers, we are a well known online resource and editorial services site in United Kingdom, Canada & America . Here, we cover all the major topics from self help guide to A Guide to Business, Guide to Finance, Ideas for Marketing, Legal Guide, Lettre De Motivation, Guide to Insurance, Guide to Health, Guide to Medical, Military Service, Guide to Women, Pet Guide, Politics and Policy , Guide to Technology, The Travel Guide, Information on Cars, Entertainment Guide, Family Guide to, Hobbies and Interests, Quality Home Improvement, Arts & Humanities and many more.
About Editorial Today | Contact Us | Terms of Use | Submit an Article | Our Authors