-
Notifications
You must be signed in to change notification settings - Fork 0
/
collection.go
41 lines (29 loc) · 1.19 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
package collection
// Collection is the root interface for this collections framework hierarchy.
type Collection[T any] interface {
// 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
// Iter returns a channel of all elements in this collection.
Iter() <-chan T
// 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
// 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
}