Repository navigation
Expand file tree
/
Copy pathWeissCollection.java
More file actions
68 lines (59 loc) · 1.82 KB
/
Copy pathWeissCollection.java
File metadata and controls
68 lines (59 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import java.util.Iterator;
/**
* Collection interface; the root of all 1.5 collections.
*
* @param <T> the type of items in this collection
*/
public interface WeissCollection<T> extends Iterable<T>, java.io.Serializable
{
/**
* Returns the number of items in this collection.
* @return the number of items in this collection.
*/
int size( );
/**
* Tests if this collection is empty.
* @return true if the size of this collection is zero.
*/
boolean isEmpty( );
/**
* Tests if some item is in this collection.
* @param x any object.
* @return true if this collection contains an item equal to x.
*/
boolean contains( Object x );
/**
* Adds an item to this collection.
* @param x any object.
* @return true if this item was added to the collection.
*/
boolean add( T x );
/**
* Removes an item from this collection.
* @param x any object.
* @return true if this item was removed from the collection.
*/
boolean remove( Object x );
/**
* Change the size of this collection to zero.
*/
void clear( );
/**
* Obtains an Iterator object used to traverse the collection.
* @return an iterator positioned prior to the first element.
*/
Iterator<T> iterator( );
/**
* Obtains a primitive array view of the collection.
* @return the primitive array view.
*/
Object [ ] toArray( );
/**
* Returns an array copy of this collection as type E.
*
* @param <E> the other type for the new array
* @param arr an example array for using reflection to creates the array desired
* @return the array representation of this collection
*/
<E> E [ ] toArray( E [ ] arr );
}