org.apache.tools.ant.util

Class LazyHashtable


public class LazyHashtable
extends 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

Field Summary

protected boolean
initAllDone

Constructor Summary

LazyHashtable()
No arg constructor.

Method Summary

boolean
contains(Object value)
Check if the table contains a particular value.
boolean
containsKey(Object value)
Check if the table contains a particular key.
boolean
containsValue(Object value)
Delegates to contains.
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.
Enumeration
keys()
Get an enumeration over the keys.
int
size()
Get the size of the table.

Field Details

initAllDone

protected boolean initAllDone

Constructor Details

LazyHashtable

public LazyHashtable()
No arg constructor.

Method Details

contains

public boolean contains(Object value)
Check if the table contains a particular value.
Parameters:
value - the value to look for.
Returns:
true if the table contains the value.

containsKey

public boolean containsKey(Object value)
Check if the table contains a particular key.
Parameters:
value - the key to look for.
Returns:
true if the table contains key.

containsValue

public boolean containsValue(Object value)
Parameters:
value - the value to look for.
Returns:
true if the table contains the value.

elements

public Enumeration elements()
Get a enumeration over the elements.
Returns:
an enumeration.

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.

isEmpty

public boolean isEmpty()
Check if the table is empty.
Returns:
true if it is.

keys

public Enumeration keys()
Get an enumeration over the keys.
Returns:
an enumeration.

size

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