Merge git+ssh://davetron5000@repo.or.cz/srv/git/vimdoclet
[vimdoclet.git] / sample / java.util.AbstractCollection.txt
bloba9a78b1edb780b2f3d7d6ae0467a20b97cee79e6
1 *java.util.AbstractCollection* *AbstractCollection* This class provides a skelet
3 public abstract class AbstractCollection
4   extends    |java.lang.Object|
5   implements |java.util.Collection|
7 |java.util.AbstractCollection_Description|
8 |java.util.AbstractCollection_Fields|
9 |java.util.AbstractCollection_Constructors|
10 |java.util.AbstractCollection_Methods|
12 ================================================================================
14 *java.util.AbstractCollection_Constructors*
15 |java.util.AbstractCollection()|Sole constructor.
17 *java.util.AbstractCollection_Methods*
18 |java.util.AbstractCollection.add(E)|Ensures that this collection contains the 
19 |java.util.AbstractCollection.addAll(Collection)|Adds all of the elements in th
20 |java.util.AbstractCollection.clear()|Removes all of the elements from this col
21 |java.util.AbstractCollection.contains(Object)|Returns true if this collection 
22 |java.util.AbstractCollection.containsAll(Collection)|Returns true if this coll
23 |java.util.AbstractCollection.isEmpty()|Returns true if this collection contain
24 |java.util.AbstractCollection.iterator()|Returns an iterator over the elements 
25 |java.util.AbstractCollection.remove(Object)|Removes a single instance of the s
26 |java.util.AbstractCollection.removeAll(Collection)|Removes from this collectio
27 |java.util.AbstractCollection.retainAll(Collection)|Retains only the elements i
28 |java.util.AbstractCollection.size()|Returns the number of elements in this col
29 |java.util.AbstractCollection.toArray()|Returns an array containing all of the 
30 |java.util.AbstractCollection.toArray(T[])|Returns an array containing all of t
31 |java.util.AbstractCollection.toString()|Returns a string representation of thi
33 *java.util.AbstractCollection_Description*
35 This class provides a skeletal implementation of the Collection interface, to 
36 minimize the effort required to implement this interface. 
38 To implement an unmodifiable collection, the programmer needs only to extend 
39 this class and provide implementations for the iterator and size methods. (The 
40 iterator returned by the iterator method must implement hasNext and next.) 
42 To implement a modifiable collection, the programmer must additionally override 
43 this class's add method (which otherwise throws an 
44 UnsupportedOperationException), and the iterator returned by the iterator 
45 method must additionally implement its remove method. 
47 The programmer should generally provide a void (no argument) and Collection 
48 constructor, as per the recommendation in the Collection interface 
49 specification. 
51 The documentation for each non-abstract methods in this class describes its 
52 implementation in detail. Each of these methods may be overridden if the 
53 collection being implemented admits a more efficient implementation. 
55 This class is a member of the <a href="/../guide/collections/index.html"> Java 
56 Collections Framework. 
59 *java.util.AbstractCollection()*
61 protected AbstractCollection()
63 Sole constructor. (For invocation by subclass constructors, typically 
64 implicit.) 
67 *java.util.AbstractCollection.add(E)*
69 public boolean add(java.lang.Object o)
71 Ensures that this collection contains the specified element (optional 
72 operation). Returns true if the collection changed as a result of the call. 
73 (Returns false if this collection does not permit duplicates and already 
74 contains the specified element.) Collections that support this operation may 
75 place limitations on what elements may be added to the collection. In 
76 particular, some collections will refuse to add null elements, and others will 
77 impose restrictions on the type of elements that may be added. Collection 
78 classes should clearly specify in their documentation any restrictions on what 
79 elements may be added. 
81 This implementation always throws an UnsupportedOperationException. 
83     o - element whose presence in this collection is to be ensured. 
85     Returns: true if the collection changed as a result of the call. 
86 *java.util.AbstractCollection.addAll(Collection)*
88 public boolean addAll(java.util.Collection c)
90 Adds all of the elements in the specified collection to this collection 
91 (optional operation). The behavior of this operation is undefined if the 
92 specified collection is modified while the operation is in progress. (This 
93 implies that the behavior of this call is undefined if the specified collection 
94 is this collection, and this collection is nonempty.) 
96 This implementation iterates over the specified collection, and adds each 
97 object returned by the iterator to this collection, in turn. 
99 Note that this implementation will throw an UnsupportedOperationException 
100 unless add is overridden (assuming the specified collection is non-empty). 
102     c - collection whose elements are to be added to this collection. 
104     Returns: true if this collection changed as a result of the call. 
105 *java.util.AbstractCollection.clear()*
107 public void clear()
109 Removes all of the elements from this collection (optional operation). The 
110 collection will be empty after this call returns (unless it throws an 
111 exception). 
113 This implementation iterates over this collection, removing each element using 
114 the Iterator.remove operation. Most implementations will probably choose to 
115 override this method for efficiency. 
117 Note that this implementation will throw an UnsupportedOperationException if 
118 the iterator returned by this collection's iterator method does not implement 
119 the remove method and this collection is non-empty. 
122 *java.util.AbstractCollection.contains(Object)*
124 public boolean contains(java.lang.Object o)
126 Returns true if this collection contains the specified element. More formally, 
127 returns true if and only if this collection contains at least one element e 
128 such that (o==null ? e==null : o.equals(e)). 
130 This implementation iterates over the elements in the collection, checking each 
131 element in turn for equality with the specified element. 
133     o - object to be checked for containment in this collection. 
135     Returns: true if this collection contains the specified element. 
136 *java.util.AbstractCollection.containsAll(Collection)*
138 public boolean containsAll(java.util.Collection c)
140 Returns true if this collection contains all of the elements in the specified 
141 collection. 
143 This implementation iterates over the specified collection, checking each 
144 element returned by the iterator in turn to see if it's contained in this 
145 collection. If all elements are so contained true is returned, otherwise false. 
147     c - collection to be checked for containment in this collection. 
149     Returns: true if this collection contains all of the elements in the specified 
150              collection. 
151 *java.util.AbstractCollection.isEmpty()*
153 public boolean isEmpty()
155 Returns true if this collection contains no elements. 
157 This implementation returns size() == 0. 
160     Returns: true if this collection contains no elements. 
161 *java.util.AbstractCollection.iterator()*
163 public abstract |java.util.Iterator| iterator()
165 Returns an iterator over the elements contained in this collection. 
168     Returns: an iterator over the elements contained in this collection. 
169 *java.util.AbstractCollection.remove(Object)*
171 public boolean remove(java.lang.Object o)
173 Removes a single instance of the specified element from this collection, if it 
174 is present (optional operation). More formally, removes an element e such that 
175 (o==null ? e==null : o.equals(e)), if the collection contains one or more such 
176 elements. Returns true if the collection contained the specified element (or 
177 equivalently, if the collection changed as a result of the call). 
179 This implementation iterates over the collection looking for the specified 
180 element. If it finds the element, it removes the element from the collection 
181 using the iterator's remove method. 
183 Note that this implementation throws an UnsupportedOperationException if the 
184 iterator returned by this collection's iterator method does not implement the 
185 remove method and this collection contains the specified object. 
187     o - element to be removed from this collection, if present. 
189     Returns: true if the collection contained the specified element. 
190 *java.util.AbstractCollection.removeAll(Collection)*
192 public boolean removeAll(java.util.Collection c)
194 Removes from this collection all of its elements that are contained in the 
195 specified collection (optional operation). 
197 This implementation iterates over this collection, checking each element 
198 returned by the iterator in turn to see if it's contained in the specified 
199 collection. If it's so contained, it's removed from this collection with the 
200 iterator's remove method. 
202 Note that this implementation will throw an UnsupportedOperationException if 
203 the iterator returned by the iterator method does not implement the remove 
204 method and this collection contains one or more elements in common with the 
205 specified collection. 
207     c - elements to be removed from this collection. 
209     Returns: true if this collection changed as a result of the call. 
210 *java.util.AbstractCollection.retainAll(Collection)*
212 public boolean retainAll(java.util.Collection c)
214 Retains only the elements in this collection that are contained in the 
215 specified collection (optional operation). In other words, removes from this 
216 collection all of its elements that are not contained in the specified 
217 collection. 
219 This implementation iterates over this collection, checking each element 
220 returned by the iterator in turn to see if it's contained in the specified 
221 collection. If it's not so contained, it's removed from this collection with 
222 the iterator's remove method. 
224 Note that this implementation will throw an UnsupportedOperationException if 
225 the iterator returned by the iterator method does not implement the remove 
226 method and this collection contains one or more elements not present in the 
227 specified collection. 
229     c - elements to be retained in this collection. 
231     Returns: true if this collection changed as a result of the call. 
232 *java.util.AbstractCollection.size()*
234 public abstract int size()
236 Returns the number of elements in this collection. If the collection contains 
237 more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE. 
240     Returns: the number of elements in this collection. 
241 *java.util.AbstractCollection.toArray()*
243 public |java.lang.Object| toArray()
245 Returns an array containing all of the elements in this collection. If the 
246 collection makes any guarantees as to what order its elements are returned by 
247 its iterator, this method must return the elements in the same order. The 
248 returned array will be "safe" in that no references to it are maintained by the 
249 collection. (In other words, this method must allocate a new array even if the 
250 collection is backed by an Array). The caller is thus free to modify the 
251 returned array. 
253 This implementation allocates the array to be returned, and iterates over the 
254 elements in the collection, storing each object reference in the next 
255 consecutive element of the array, starting with element 0. 
258     Returns: an array containing all of the elements in this collection. 
259 *java.util.AbstractCollection.toArray(T[])*
261 public |java.lang.Object| toArray(java.lang.Object[] a)
263 Returns an array containing all of the elements in this collection; the runtime 
264 type of the returned array is that of the specified array. If the collection 
265 fits in the specified array, it is returned therein. Otherwise, a new array is 
266 allocated with the runtime type of the specified array and the size of this 
267 collection. 
269 If the collection fits in the specified array with room to spare (i.e., the 
270 array has more elements than the collection), the element in the array 
271 immediately following the end of the collection is set to null. This is useful 
272 in determining the length of the collection only if the caller knows that the 
273 collection does not contain any null elements.) 
275 If this collection makes any guarantees as to what order its elements are 
276 returned by its iterator, this method must return the elements in the same 
277 order. 
279 This implementation checks if the array is large enough to contain the 
280 collection; if not, it allocates a new array of the correct size and type 
281 (using reflection). Then, it iterates over the collection, storing each object 
282 reference in the next consecutive element of the array, starting with element 
283 0. If the array is larger than the collection, a null is stored in the first 
284 location after the end of the collection. 
286     a - the array into which the elements of the collection are to be stored, if it is 
287        big enough; otherwise, a new array of the same runtime type is allocated 
288        for this purpose. 
290     Returns: an array containing the elements of the collection. 
291 *java.util.AbstractCollection.toString()*
293 public |java.lang.String| toString()
295 Returns a string representation of this collection. The string representation 
296 consists of a list of the collection's elements in the order they are returned 
297 by its iterator, enclosed in square brackets ("[]"). Adjacent elements are 
298 separated by the characters ", " (comma and space). Elements are converted to 
299 strings as by String.valueOf(Object). 
301 This implementation creates an empty string buffer, appends a left square 
302 bracket, and iterates over the collection appending the string representation 
303 of each element in turn. After appending each element except the last, the 
304 string ", " is appended. Finally a right bracket is appended. A string is 
305 obtained from the string buffer, and returned. 
308     Returns: a string representation of this collection.