-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcollection.go
47 lines (33 loc) · 1.38 KB
/
collection.go
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
package collection
// Collection is the root interface for this collections framework hierarchy.
type Collection[T any] interface {
Iterable[T]
// Add adds the specified element to this collection.
Add(e T) bool
// AddAll adds all of the elements in the this collection.
AddAll(c ...T) bool
// Clear removes all of the elements from this collection.
Clear()
// Contains returns true if this collection contains the specified element.
Contains(e T) bool
// ContainsAll returns true if this collection contains all of the elements in the specified
// collection.
ContainsAll(c ...T) bool
// Equals compares this collection with the object pass from parameter.
Equals(o any) bool
// IsEmpty returns true if this collection contains no elements.
IsEmpty() bool
// Remove removes the specified element from this collection.
Remove(e T) bool
// RemoveAll removes all of the elements in the specified collection from this collection.
RemoveAll(c ...T) bool
// RemoveIf removes all of the elements of this collection that satisfy the given predicate.
RemoveIf(f func(T) bool) bool
// RetainAll retains only the elements in this collection that are contained in the specified
// collection.
RetainAll(c ...T) bool
// Size returns the number of elements in this collection.
Size() int
// ToSlice returns a slice containing all of the elements in this collection.
ToSlice() []T
}