Java Doc for FastCollection.java in  » Science » javolution-5.2 » javolution » util » 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 » Science » javolution 5.2 » javolution.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javolution.util.FastCollection

All known Subclasses:   javolution.util.FastList,  javolution.util.FastSet,  javolution.util.FastTable,
FastCollection
abstract public class FastCollection implements Collection,XMLSerializable,Realtime(Code)

This class represents collections which can quickly be iterated over (forward or backward) in a thread-safe manner without creating new objects and without using FastCollection.iterator iterators . For example:[code] boolean search(Object item, FastCollection c) { for (Record r = c.head(), end = c.tail(); (r = r.getNext()) != end;) { if (item.equals(c.valueOf(r))) return true; } return false; }[/code]

Iterations are thread-safe as long as the Record record sequence iterated over is not structurally modified by another thread (objects can safely be append/prepend during iterations but not inserted/removed).

Users may provide a read-only view of any FastCollection instance using the FastCollection.unmodifiable() method (the view is thread-safe if iterations are thread-safe). For example:[code] public class Polynomial { private final FastTable _coefficients = new FastTable(); public List getCoefficients() { // Read-only view. return _coefficients.unmodifiable(); } }[/code]

Finally, FastCollection may use custom FastCollection.getValueComparatorcomparators for element equality or ordering if the collection is ordered (e.g. FastTree).
author:
   Jean-Marie Dautelle
version:
   4.2, December 18, 2006


Inner Class :public interface Record


Constructor Summary
protected  FastCollection()
     Default constructor.

Method Summary
public  booleanadd(Object value)
     Appends the specified value to the end of this collection (optional operation).

Note: This default implementation always throws UnsupportedOperationException.


Parameters:
  value - the value to be appended to this collection.
public  booleanaddAll(Collection c)
     Appends all of the values in the specified collection to the end of this collection, in the order that they are returned by the specified collection's iterator or the node order if the specified collection is a FastCollection .
Parameters:
  c - collection whose values are to be added to this collection.
public  voidclear()
     Removes all of the values from this collection (optional operation).
public  booleancontains(Object value)
     Indicates if this collection contains the specified value.
Parameters:
  value - the value whose presence in this collection is to be tested.
public  booleancontainsAll(Collection c)
     Indicates if this collection contains all of the values of the specified collection.
Parameters:
  c - collection to be checked for containment in this collection.
abstract public  voiddelete(Record record)
     Deletes the specified record from this collection.

Implementation must ensure that removing a record from the collection does not affect in any way the records preceding the record being removed (it might affect the next records though, e.g.

public  booleanequals(Object obj)
     Compares the specified object with this collection for equality.
public  FastComparatorgetValueComparator()
     Returns the value comparator for this collection (default FastComparator.DEFAULT ).
public  inthashCode()
     Returns the hash code for this collection (independent from the collection order; unless this collection is a list instance).
abstract public  Recordhead()
     Returns the head record of this collection; it is the record such as head().getNext() holds the first collection value.
final public  booleanisEmpty()
     Indicates if this collection is empty.
public  Iteratoriterator()
     Returns an iterator over the elements in this collection (allocated on the stack when executed in a javolution.context.StackContext StackContext ).
public  booleanremove(Object value)
     Removes the first occurrence in this collection of the specified value (optional operation).
Parameters:
  value - the value to be removed from this collection.
public  booleanremoveAll(Collection c)
     Removes from this collection all the values that are contained in the specified collection.
Parameters:
  c - collection that defines which values will be removed fromthis collection.
public  booleanretainAll(Collection c)
     Retains only the values in this collection that are contained in the specified collection.
Parameters:
  c - collection that defines which values this set will retain.
abstract public  intsize()
     Returns the number of values in this collection.
abstract public  Recordtail()
     Returns the tail record of this collection; it is the record such as tail().getPrevious() holds the last collection value.
public  Object[]toArray()
     Returns a new array allocated on the heap containing all of the values in this collection in proper sequence.
public  Object/*{ T}*/[]toArray(Object/*{T}*/[] array)
     Fills the specified array with the values of this collection in the proper sequence.

Note: Unlike standard Collection, this method does not try to resize the array using reflection (which might not be supported) if the array is too small.

final public  StringtoString()
     Returns the String representation of this FastCollection .
public  TexttoText()
     Returns the textual representation of this collection.
public  Collectionunmodifiable()
     Returns the unmodifiable view associated to this collection.
abstract public  ObjectvalueOf(Record record)
     Returns the collection value for the specified record.
Parameters:
  record - the record whose current value is returned.


Constructor Detail
FastCollection
protected FastCollection()(Code)
Default constructor.




Method Detail
add
public boolean add(Object value)(Code)
Appends the specified value to the end of this collection (optional operation).

Note: This default implementation always throws UnsupportedOperationException.


Parameters:
  value - the value to be appended to this collection. true (as per the general contract of theCollection.add method).
throws:
  UnsupportedOperationException - if not supported.



addAll
public boolean addAll(Collection c)(Code)
Appends all of the values in the specified collection to the end of this collection, in the order that they are returned by the specified collection's iterator or the node order if the specified collection is a FastCollection .
Parameters:
  c - collection whose values are to be added to this collection. true if this collection changed as a result of the call; false otherwise.



clear
public void clear()(Code)
Removes all of the values from this collection (optional operation).
throws:
  UnsupportedOperationException - if not supported.



contains
public boolean contains(Object value)(Code)
Indicates if this collection contains the specified value.
Parameters:
  value - the value whose presence in this collection is to be tested. true if this collection contains the specifiedvalue;false otherwise.



containsAll
public boolean containsAll(Collection c)(Code)
Indicates if this collection contains all of the values of the specified collection.
Parameters:
  c - collection to be checked for containment in this collection. true if this collection contains all of the valuesof the specified collection; false otherwise.



delete
abstract public void delete(Record record)(Code)
Deletes the specified record from this collection.

Implementation must ensure that removing a record from the collection does not affect in any way the records preceding the record being removed (it might affect the next records though, e.g. in a list collection, the indices of the subsequent records will change).


Parameters:
  record - the record to be removed.
throws:
  UnsupportedOperationException - if not supported.



equals
public boolean equals(Object obj)(Code)
Compares the specified object with this collection for equality. Returns true if and only both collection contains the same values regardless of the order; unless this collection is a list instance in which case both collections must be list with the same order.
Parameters:
  obj - the object to be compared for equality with this collection. true if the specified object is equal to thiscollection; false otherwise.



getValueComparator
public FastComparator getValueComparator()(Code)
Returns the value comparator for this collection (default FastComparator.DEFAULT ). the comparator to use for value equality (or ordering if the collection is ordered)



hashCode
public int hashCode()(Code)
Returns the hash code for this collection (independent from the collection order; unless this collection is a list instance). the hash code for this collection.



head
abstract public Record head()(Code)
Returns the head record of this collection; it is the record such as head().getNext() holds the first collection value. the head record.



isEmpty
final public boolean isEmpty()(Code)
Indicates if this collection is empty. true if this collection contains no value;false otherwise.



iterator
public Iterator iterator()(Code)
Returns an iterator over the elements in this collection (allocated on the stack when executed in a javolution.context.StackContext StackContext ). an iterator over this collection's elements.



remove
public boolean remove(Object value)(Code)
Removes the first occurrence in this collection of the specified value (optional operation).
Parameters:
  value - the value to be removed from this collection. true if this collection contained the specifiedvalue; false otherwise.
throws:
  UnsupportedOperationException - if not supported.



removeAll
public boolean removeAll(Collection c)(Code)
Removes from this collection all the values that are contained in the specified collection.
Parameters:
  c - collection that defines which values will be removed fromthis collection. true if this collection changed as a result of the call; false otherwise.



retainAll
public boolean retainAll(Collection c)(Code)
Retains only the values in this collection that are contained in the specified collection.
Parameters:
  c - collection that defines which values this set will retain. true if this collection changed as a result of the call; false otherwise.



size
abstract public int size()(Code)
Returns the number of values in this collection. the number of values.



tail
abstract public Record tail()(Code)
Returns the tail record of this collection; it is the record such as tail().getPrevious() holds the last collection value. the tail record.



toArray
public Object[] toArray()(Code)
Returns a new array allocated on the heap containing all of the values in this collection in proper sequence.

Note: To avoid heap allocation FastCollection.toArray(Object[]) is recommended.

toArray(new Object[size()])



toArray
public Object/*{ T}*/[] toArray(Object/*{T}*/[] array)(Code)
Fills the specified array with the values of this collection in the proper sequence.

Note: Unlike standard Collection, this method does not try to resize the array using reflection (which might not be supported) if the array is too small. UnsupportedOperationException is raised if the specified array is too small for this collection.


Parameters:
  array - the array into which the values of this collectionare to be stored. the specified array.
throws:
  UnsupportedOperationException - if array.length < size()



toString
final public String toString()(Code)
Returns the String representation of this FastCollection . toText().toString()



toText
public Text toText()(Code)
Returns the textual representation of this collection. this collection textual representation.



unmodifiable
public Collection unmodifiable()(Code)
Returns the unmodifiable view associated to this collection. Attempts to modify the returned collection result in an UnsupportedOperationException being thrown. The view is typically part of the collection itself (created only once) and also an instance of FastCollection supporting direct iterations. the unmodifiable view over this collection.



valueOf
abstract public Object valueOf(Record record)(Code)
Returns the collection value for the specified record.
Parameters:
  record - the record whose current value is returned. the current value.



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.