Java Doc for Hashtable.java in  » 6.0-JDK-Core » Collections-Jar-Zip-Logging-regex » java » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
Java Source Code / Java Documentation
1.6.0 JDK Core
2.6.0 JDK Modules
3.6.0 JDK Modules com.sun
4.6.0 JDK Modules com.sun.java
5.6.0 JDK Modules sun
6.6.0 JDK Platform
7.Ajax
8.Apache Harmony Java SE
9.Aspect oriented
10.Authentication Authorization
11.Blogger System
12.Build
13.Byte Code
14.Cache
15.Chart
16.Chat
17.Code Analyzer
18.Collaboration
19.Content Management System
20.Database Client
21.Database DBMS
22.Database JDBC Connection Pool
23.Database ORM
24.Development
25.EJB Server
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » Collections Jar Zip Logging regex » java.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.util.Hashtable

Hashtable
public class Hashtable extends Dictionary implements Map<K, V>,Cloneable,java.io.Serializable(Code)



Constructor Summary
public  Hashtable(int initialCapacity, float loadFactor)
     Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
public  Hashtable(int initialCapacity)
     Constructs a new, empty hashtable with the specified initial capacity and default load factor (0.75).
public  Hashtable()
     Constructs a new, empty hashtable with a default initial capacity (11) and load factor (0.75).
public  Hashtable(Map<? extends K, ? extends V> t)
     Constructs a new hashtable with the same mappings as the given Map.

Method Summary
public synchronized  voidclear()
     Clears this hashtable so that it contains no keys.
public synchronized  Objectclone()
     Creates a shallow copy of this hashtable.
public synchronized  booleancontains(Object value)
     Tests if some key maps into the specified value in this hashtable.
public synchronized  booleancontainsKey(Object key)
     Tests if the specified object is a key in this hashtable.
public  booleancontainsValue(Object value)
     Returns true if this hashtable maps one or more keys to this value.
public synchronized  Enumeration<V>elements()
     Returns an enumeration of the values in this hashtable.
public  Set<Map.Entry<K, V>>entrySet()
     Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.
public synchronized  booleanequals(Object o)
     Compares the specified Object with this Map for equality, as per the definition in the Map interface.
public synchronized  Vget(Object key)
     Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that (key.equals(k)) , then this method returns v ; otherwise it returns null .

public synchronized  inthashCode()
     Returns the hash code value for this Map as per the definition in the Map interface.
public synchronized  booleanisEmpty()
     Tests if this hashtable maps no keys to values.
public  Set<K>keySet()
     Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.
public synchronized  Enumeration<K>keys()
     Returns an enumeration of the keys in this hashtable.
public synchronized  Vput(K key, V value)
     Maps the specified key to the specified value in this hashtable.
public synchronized  voidputAll(Map<? extends K, ? extends V> t)
     Copies all of the mappings from the specified map to this hashtable.
protected  voidrehash()
     Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently.
public synchronized  Vremove(Object key)
     Removes the key (and its corresponding value) from this hashtable.
public synchronized  intsize()
     Returns the number of keys in this hashtable.
public synchronized  StringtoString()
     Returns a string representation of this Hashtable object in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space).
public  Collection<V>values()
     Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa.


Constructor Detail
Hashtable
public Hashtable(int initialCapacity, float loadFactor)(Code)
Constructs a new, empty hashtable with the specified initial capacity and the specified load factor.
Parameters:
  initialCapacity - the initial capacity of the hashtable.
Parameters:
  loadFactor - the load factor of the hashtable.
exception:
  IllegalArgumentException - if the initial capacity is lessthan zero, or if the load factor is nonpositive.



Hashtable
public Hashtable(int initialCapacity)(Code)
Constructs a new, empty hashtable with the specified initial capacity and default load factor (0.75).
Parameters:
  initialCapacity - the initial capacity of the hashtable.
exception:
  IllegalArgumentException - if the initial capacity is lessthan zero.



Hashtable
public Hashtable()(Code)
Constructs a new, empty hashtable with a default initial capacity (11) and load factor (0.75).



Hashtable
public Hashtable(Map<? extends K, ? extends V> t)(Code)
Constructs a new hashtable with the same mappings as the given Map. The hashtable is created with an initial capacity sufficient to hold the mappings in the given Map and a default load factor (0.75).
Parameters:
  t - the map whose mappings are to be placed in this map.
throws:
  NullPointerException - if the specified map is null.
since:
   1.2




Method Detail
clear
public synchronized void clear()(Code)
Clears this hashtable so that it contains no keys.



clone
public synchronized Object clone()(Code)
Creates a shallow copy of this hashtable. All the structure of the hashtable itself is copied, but the keys and values are not cloned. This is a relatively expensive operation. a clone of the hashtable



contains
public synchronized boolean contains(Object value)(Code)
Tests if some key maps into the specified value in this hashtable. This operation is more expensive than the Hashtable.containsKeycontainsKey method.

Note that this method is identical in functionality to Hashtable.containsValue containsValue , (which is part of the Map interface in the collections framework).
Parameters:
  value - a value to search for true if and only if some key maps to thevalue argument in this hashtable asdetermined by the equals method;false otherwise.
exception:
  NullPointerException - if the value is null




containsKey
public synchronized boolean containsKey(Object key)(Code)
Tests if the specified object is a key in this hashtable.
Parameters:
  key - possible key true if and only if the specified objectis a key in this hashtable, as determined by theequals method; false otherwise.
throws:
  NullPointerException - if the key is null
See Also:   Hashtable.contains(Object)



containsValue
public boolean containsValue(Object value)(Code)
Returns true if this hashtable maps one or more keys to this value.

Note that this method is identical in functionality to Hashtable.contains contains (which predates the Map interface).
Parameters:
  value - value whose presence in this hashtable is to be tested true if this map maps one or more keys to thespecified value
throws:
  NullPointerException - if the value is null
since:
   1.2




elements
public synchronized Enumeration<V> elements()(Code)
Returns an enumeration of the values in this hashtable. Use the Enumeration methods on the returned object to fetch the elements sequentially. an enumeration of the values in this hashtable.
See Also:   java.util.Enumeration
See Also:   Hashtable.keys()
See Also:   Hashtable.values()
See Also:   Map



entrySet
public Set<Map.Entry<K, V>> entrySet()(Code)
Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
since:
   1.2



equals
public synchronized boolean equals(Object o)(Code)
Compares the specified Object with this Map for equality, as per the definition in the Map interface.
Parameters:
  o - object to be compared for equality with this hashtable true if the specified Object is equal to this Map
See Also:   Map.equals(Object)
since:
   1.2



get
public synchronized V get(Object key)(Code)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that (key.equals(k)) , then this method returns v ; otherwise it returns null . (There can be at most one such mapping.)
Parameters:
  key - the key whose associated value is to be returned the value to which the specified key is mapped, or null if this map contains no mapping for the key
throws:
  NullPointerException - if the specified key is null
See Also:   Hashtable.put(Object,Object)




hashCode
public synchronized int hashCode()(Code)
Returns the hash code value for this Map as per the definition in the Map interface.
See Also:   Map.hashCode
since:
   1.2



isEmpty
public synchronized boolean isEmpty()(Code)
Tests if this hashtable maps no keys to values. true if this hashtable maps no keys to values;false otherwise.



keySet
public Set<K> keySet()(Code)
Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll, and clear operations. It does not support the add or addAll operations.
since:
   1.2



keys
public synchronized Enumeration<K> keys()(Code)
Returns an enumeration of the keys in this hashtable. an enumeration of the keys in this hashtable.
See Also:   Enumeration
See Also:   Hashtable.elements()
See Also:   Hashtable.keySet()
See Also:   Map



put
public synchronized V put(K key, V value)(Code)
Maps the specified key to the specified value in this hashtable. Neither the key nor the value can be null.

The value can be retrieved by calling the get method with a key that is equal to the original key.
Parameters:
  key - the hashtable key
Parameters:
  value - the value the previous value of the specified key in this hashtable,or null if it did not have one
exception:
  NullPointerException - if the key or value isnull
See Also:   Object.equals(Object)
See Also:   Hashtable.get(Object)




putAll
public synchronized void putAll(Map<? extends K, ? extends V> t)(Code)
Copies all of the mappings from the specified map to this hashtable. These mappings will replace any mappings that this hashtable had for any of the keys currently in the specified map.
Parameters:
  t - mappings to be stored in this map
throws:
  NullPointerException - if the specified map is null
since:
   1.2



rehash
protected void rehash()(Code)
Increases the capacity of and internally reorganizes this hashtable, in order to accommodate and access its entries more efficiently. This method is called automatically when the number of keys in the hashtable exceeds this hashtable's capacity and load factor.



remove
public synchronized V remove(Object key)(Code)
Removes the key (and its corresponding value) from this hashtable. This method does nothing if the key is not in the hashtable.
Parameters:
  key - the key that needs to be removed the value to which the key had been mapped in this hashtable,or null if the key did not have a mapping
throws:
  NullPointerException - if the key is null



size
public synchronized int size()(Code)
Returns the number of keys in this hashtable. the number of keys in this hashtable.



toString
public synchronized String toString()(Code)
Returns a string representation of this Hashtable object in the form of a set of entries, enclosed in braces and separated by the ASCII characters "" (comma and space). Each entry is rendered as the key, an equals sign =, and the associated element, where the toString method is used to convert the key and element to strings. a string representation of this hashtable



values
public Collection<V> values()(Code)
Returns a Collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa. If the map is modified while an iteration over the collection is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The collection supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Collection.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.
since:
   1.2



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.