Java Doc for SoftHashMap.java in  » Profiler » MessAdmin » clime » messadmin » providers » Java Source Code / Java DocumentationJava Source Code and Java Documentation

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 geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Profiler » MessAdmin » clime.messadmin.providers 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   java.util.AbstractMap
      clime.messadmin.providers.SoftHashMap

SoftHashMap
class SoftHashMap extends AbstractMap implements Map(Code)
A hashtable-based Map implementation with soft keys. An entry in a SoftHashMap will automatically be removed when its key is no longer in ordinary use. More precisely, the presence of a mapping for a given key will not prevent the key from being discarded by the garbage collector, that is, made finalizable, finalized, and then reclaimed. When a key has been discarded its entry is effectively removed from the map, so this class behaves somewhat differently than other Map implementations.

Both null values and the null key are supported. This class has performance characteristics similar to those of the HashMap class, and has the same efficiency parameters of initial capacity and load factor.

Like most collection classes, this class is not synchronized. A synchronized SoftHashMap may be constructed using the Collections.synchronizedMap method.

This class is intended primarily for use with key objects whose equals methods test for object identity using the == operator. Once such a key is discarded it can never be recreated, so it is impossible to do a lookup of that key in a SoftHashMap at some later time and be surprised that its entry has been removed. This class will work perfectly well with key objects whose equals methods are not based upon object identity, such as String instances. With such recreatable key objects, however, the automatic removal of SoftHashMap entries whose keys have been discarded may prove to be confusing.

The behavior of the SoftHashMap class depends in part upon the actions of the garbage collector, so several familiar (though not required) Map invariants do not hold for this class. Because the garbage collector may discard keys at any time, a SoftHashMap may behave as though an unknown thread is silently removing entries. In particular, even if you synchronize on a SoftHashMap instance and invoke none of its mutator methods, it is possible for the size method to return smaller values over time, for the isEmpty method to return false and then true, for the containsKey method to return true and later false for a given key, for the get method to return a value for a given key but later return null, for the put method to return null and the remove method to return false for a key that previously appeared to be in the map, and for successive examinations of the key set, the value set, and the entry set to yield successively smaller numbers of elements.

Each key object in a SoftHashMap is stored indirectly as the referent of a soft reference. Therefore a key will automatically be removed only after the soft references to it, both inside and outside of the map, have been cleared by the garbage collector.

Implementation note: The value objects in a SoftHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded. Note that a value object may refer indirectly to its key via the SoftHashMap itself; that is, a value object may strongly refer to some other key object whose associated value object, in turn, strongly refers to the key of the first value object. One way to deal with this is to wrap values themselves within SoftReferences before inserting, as in: m.put(key, new SoftReference(value)), and then unwrapping upon each get.
version:
   1.13, 02/06/02
author:
   Mark Reinhold, Cédrik LIME
See Also:   java.util.HashMap
See Also:   java.lang.ref.SoftReference



Field Summary
protected  Maphash
    

Constructor Summary
public  SoftHashMap(int initialCapacity, float loadFactor)
     Constructs a new, empty SoftHashMap with the given initial capacity and the given load factor.
public  SoftHashMap(int initialCapacity)
     Constructs a new, empty SoftHashMap with the given initial capacity and the default load factor, which is 0.75.
public  SoftHashMap()
     Constructs a new, empty SoftHashMap with the default initial capacity and the default load factor, which is 0.75.
public  SoftHashMap(Map t)
     Constructs a new SoftHashMap with the same mappings as the specified Map.

Method Summary
public  voidclear()
     Removes all mappings from this map.
public  booleancontainsKey(Object key)
     Returns true if this map contains a mapping for the specified key.
public  SetentrySet()
     Returns a Set view of the mappings in this map.
public  Objectget(Object key)
     Returns the value to which this map maps the specified key.
public  booleanisEmpty()
     Returns true if this map contains no key-value mappings.
protected  voidprocessQueue()
    
public  Objectput(Object key, Object value)
     Updates this map so that the given key maps to the given value.
public  Objectremove(Object key)
     Removes the mapping for the given key from this map, if present.
public  intsize()
     Returns the number of key-value mappings in this map.

Field Detail
hash
protected Map hash(Code)




Constructor Detail
SoftHashMap
public SoftHashMap(int initialCapacity, float loadFactor)(Code)
Constructs a new, empty SoftHashMap with the given initial capacity and the given load factor.
Parameters:
  initialCapacity - The initial capacity of the SoftHashMap
Parameters:
  loadFactor - The load factor of the SoftHashMap
throws:
  IllegalArgumentException - If the initial capacity is less than zero, or if the loadfactor is nonpositive



SoftHashMap
public SoftHashMap(int initialCapacity)(Code)
Constructs a new, empty SoftHashMap with the given initial capacity and the default load factor, which is 0.75.
Parameters:
  initialCapacity - The initial capacity of the SoftHashMap
throws:
  IllegalArgumentException - If the initial capacity is less than zero



SoftHashMap
public SoftHashMap()(Code)
Constructs a new, empty SoftHashMap with the default initial capacity and the default load factor, which is 0.75.



SoftHashMap
public SoftHashMap(Map t)(Code)
Constructs a new SoftHashMap with the same mappings as the specified Map. The SoftHashMap is created with an initial capacity of twice the number of mappings in the specified map or 11 (whichever is greater), and a default load factor, which is 0.75.
Parameters:
  t - the map whose mappings are to be placed in this map.
since:
   1.3




Method Detail
clear
public void clear()(Code)
Removes all mappings from this map.



containsKey
public boolean containsKey(Object key)(Code)
Returns true if this map contains a mapping for the specified key.
Parameters:
  key - The key whose presence in this map is to be tested



entrySet
public Set entrySet()(Code)
Returns a Set view of the mappings in this map.



get
public Object get(Object key)(Code)
Returns the value to which this map maps the specified key. If this map does not contain a value for this key, then return null.
Parameters:
  key - The key whose associated value, if any, is to be returned



isEmpty
public boolean isEmpty()(Code)
Returns true if this map contains no key-value mappings.



processQueue
protected void processQueue()(Code)



put
public Object put(Object key, Object value)(Code)
Updates this map so that the given key maps to the given value. If the map previously contained a mapping for key then that mapping is replaced and the previous value is returned.
Parameters:
  key - The key that is to be mapped to the given value
Parameters:
  value - The value to which the given key is to bemapped The previous value to which this key was mapped, ornull if if there was no mapping for the key



remove
public Object remove(Object key)(Code)
Removes the mapping for the given key from this map, if present.
Parameters:
  key - The key whose mapping is to be removed The value to which this key was mapped, or null ifthere was no mapping for the key



size
public int size()(Code)
Returns the number of key-value mappings in this map. Note: In contrast with most implementations of the Map interface, the time required by this operation is linear in the size of the map.



Methods inherited from java.util.AbstractMap
public void clear()(Code)(Java Doc)
protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean containsKey(Object key)(Code)(Java Doc)
public boolean containsValue(Object value)(Code)(Java Doc)
abstract public Set<Entry<K, V>> entrySet()(Code)(Java Doc)
public boolean equals(Object o)(Code)(Java Doc)
public V get(Object key)(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public boolean isEmpty()(Code)(Java Doc)
public Set<K> keySet()(Code)(Java Doc)
public V put(K key, V value)(Code)(Java Doc)
public void putAll(Map<? extends K, ? extends V> m)(Code)(Java Doc)
public V remove(Object key)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
public Collection<V> values()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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