Java Doc for WeakHashSet.java in  » Content-Management-System » harmonise » oreilly » hcj » references » 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 » Content Management System » harmonise » oreilly.hcj.references 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.util.AbstractSet
   oreilly.hcj.references.WeakHashSet

WeakHashSet
public class WeakHashSet extends AbstractSet implements Set(Code)
Implements a HashSet where the objects given are stored in weak references.

Uses the WeakHashMap class as a backing store to implement a set of objects that are stored as weak references. All information concerning using keys in the WeakHashMap class pertain to this class and it is reccomended that the user of this class review that material before using the class.

Because this set contains only weak references, it is not serializable. If one tried to serialize a weak reference, the results would be highly unpredictable as the object could likely vanish from memory before the proces was even completed. Users of this class must use transient when the containing class uses this set.

Because of the semantics of the weak references, the value null is not allowed in this set.

This collection is not identity based but equality based. This can cause some confusion as you cannot put in two objects whose equals() methods return true. It also means that an object being held is not necessarily the same one that the user is holding. For example, you could have a String with the value 'fred' at memory location X and ther could be another String with the value 'fred' at memory location Y. The first instance is in the set but the second isn't.


author:
   Robert Simmons jr.
version:
   $Revision: 1.1 $
See Also:   java.lang.util.WeakHashMap
See Also:   java.lang.ref.WeakReference


Field Summary
 WeakHashMapbackingStore
     Holds the backing store.

Constructor Summary
public  WeakHashSet()
     Constructs a new empty WeakHashSet with default values passed the the backing store.
public  WeakHashSet(Collection c)
     Constructs a new WeakHashSet with default values passed the the backing store and fills it with the given collection.
public  WeakHashSet(int initialCapacity, float loadFactor)
     Constructs a new WeakHashSet with the values given passed the the backing store.
public  WeakHashSet(int initialCapacity)
     Constructs a new WeakHashSet with the values given passed the the backing store.

Method Summary
public  booleanadd(Object o)
    
public  booleanaddAll(Collection c)
    
public  voidclear()
    
protected  Objectclone()
    
public  booleancontains(Object o)
    
public  booleancontainsAll(Collection c)
    
public  booleanequals(Object o)
    
public  inthashCode()
     Returns the hash code value for this set.

Gives back the hashCode for the backing store key set.

public  booleanisEmpty()
    
public  Iteratoriterator()
     Returns an iterator over the elements contained in this collection.

Note that this iterator is extremely volatile because the user may iterate over an element in the set and find seconds later that it has been removed.

public  booleanremove(Object o)
    
public  booleanremoveAll(Collection c)
    
public  booleanretainAll(Collection c)
    
public  intsize()
    
public  Object[]toArray()
    
public  Object[]toArray(Object[] a)
    
public  StringtoString()
    

Field Detail
backingStore
WeakHashMap backingStore(Code)
Holds the backing store.




Constructor Detail
WeakHashSet
public WeakHashSet()(Code)
Constructs a new empty WeakHashSet with default values passed the the backing store.
See Also:   java.util.WeakHashMap.WeakHashMap



WeakHashSet
public WeakHashSet(Collection c)(Code)
Constructs a new WeakHashSet with default values passed the the backing store and fills it with the given collection. Note that duplicates in the collection will merely be overwritten
See Also:   java.util.WeakHashMap.WeakHashMap(Collection)



WeakHashSet
public WeakHashSet(int initialCapacity, float loadFactor)(Code)
Constructs a new WeakHashSet with the values given passed the the backing store.
See Also:   java.util.WeakHashMap.WeakHashMap(intfloat)



WeakHashSet
public WeakHashSet(int initialCapacity)(Code)
Constructs a new WeakHashSet with the values given passed the the backing store.
See Also:   java.util.WeakHashMap.WeakHashMap(int)




Method Detail
add
public boolean add(Object o)(Code)

throws:
  NullPointerException - If the user tries to add null to the set.



addAll
public boolean addAll(Collection c)(Code)

See Also:   WeakHashSet.add(Object)



clear
public void clear()(Code)



clone
protected Object clone() throws CloneNotSupportedException(Code)



contains
public boolean contains(Object o)(Code)



containsAll
public boolean containsAll(Collection c)(Code)



equals
public boolean equals(Object o)(Code)



hashCode
public int hashCode()(Code)
Returns the hash code value for this set.

Gives back the hashCode for the backing store key set. The user should be aware, however, that this hash code can change without user intervention as the objects in the collection can easily be collected microseconds after completetion of the method. It is not reccomended that the user rely on this hash code for consistency

The hashcode for this object.



isEmpty
public boolean isEmpty()(Code)



iterator
public Iterator iterator()(Code)
Returns an iterator over the elements contained in this collection.

Note that this iterator is extremely volatile because the user may iterate over an element in the set and find seconds later that it has been removed. This is because of the semantics of weak references which act like a second thread is silently modifying the collection. For this reason, it is advisable that if the user wants to do something with the set that they maintain a strong reference to the object and not rely on it being in the collection for them.

This iterator is fail fast and WeakReference transparrent. By this we mean that the iterator simply ignores objects pending in the reference queue for cleanup.

The iterator.



remove
public boolean remove(Object o)(Code)



removeAll
public boolean removeAll(Collection c)(Code)



retainAll
public boolean retainAll(Collection c)(Code)



size
public int size()(Code)



toArray
public Object[] toArray()(Code)



toArray
public Object[] toArray(Object[] a)(Code)



toString
public String toString()(Code)



Methods inherited from java.util.AbstractSet
public boolean equals(Object o)(Code)(Java Doc)
public int hashCode()(Code)(Java Doc)
public boolean removeAll(Collection c)(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.