org.apache.tools.ant.util
Class LazyHashtable

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by java.util.Hashtable
          extended by org.apache.tools.ant.util.LazyHashtable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map

public class LazyHashtable
extends java.util.Hashtable

Hashtable implementation that allows delayed construction of expensive objects All operations that need access to the full list of objects will call initAll() first. Get and put are cheap.

Since:
Ant 1.6
See Also:
Serialized Form

Field Summary
protected  boolean initAllDone
           
 
Constructor Summary
LazyHashtable()
          No arg constructor.
 
Method Summary
 boolean contains(java.lang.Object value)
          Check if the table contains a particular value.
 boolean containsKey(java.lang.Object value)
          Check if the table contains a particular key.
 boolean containsValue(java.lang.Object value)
          Delegates to contains.
 java.util.Enumeration elements()
          Get a enumeration over the elements.
protected  void initAll()
          Used to be part of init.
 boolean isEmpty()
          Check if the table is empty.
 java.util.Enumeration keys()
          Get an enumeration over the keys.
 int size()
          Get the size of the table.
 
Methods inherited from class java.util.Hashtable
clear, clone, entrySet, equals, get, hashCode, keySet, put, putAll, rehash, remove, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

initAllDone

protected boolean initAllDone
Constructor Detail

LazyHashtable

public LazyHashtable()
No arg constructor.

Method Detail

initAll

protected void initAll()
Used to be part of init. It must be done once - but we delay it until we do need _all_ tasks. Otherwise we just get the tasks that we need, and avoid costly init.


elements

public java.util.Enumeration elements()
Get a enumeration over the elements.

Overrides:
elements in class java.util.Hashtable
Returns:
an enumeration.

isEmpty

public boolean isEmpty()
Check if the table is empty.

Specified by:
isEmpty in interface java.util.Map
Overrides:
isEmpty in class java.util.Hashtable
Returns:
true if it is.

size

public int size()
Get the size of the table.

Specified by:
size in interface java.util.Map
Overrides:
size in class java.util.Hashtable
Returns:
the size.

contains

public boolean contains(java.lang.Object value)
Check if the table contains a particular value.

Overrides:
contains in class java.util.Hashtable
Parameters:
value - the value to look for.
Returns:
true if the table contains the value.

containsKey

public boolean containsKey(java.lang.Object value)
Check if the table contains a particular key.

Specified by:
containsKey in interface java.util.Map
Overrides:
containsKey in class java.util.Hashtable
Parameters:
value - the key to look for.
Returns:
true if the table contains key.

containsValue

public boolean containsValue(java.lang.Object value)
Delegates to contains.

Specified by:
containsValue in interface java.util.Map
Overrides:
containsValue in class java.util.Hashtable
Parameters:
value - the value to look for.
Returns:
true if the table contains the value.

keys

public java.util.Enumeration keys()
Get an enumeration over the keys.

Overrides:
keys in class java.util.Hashtable
Returns:
an enumeration.