| 1 | // Copyright (c) 2015, Emir Pasic. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | // Package sets provides an abstract Set interface. |
| 6 | // |
| 7 | // In computer science, a set is an abstract data type that can store certain values and no repeated values. It is a computer implementation of the mathematical concept of a finite set. Unlike most other collection types, rather than retrieving a specific element from a set, one typically tests a value for membership in a set. |
| 8 | // |
| 9 | // Reference: https://en.wikipedia.org/wiki/Set_%28abstract_data_type%29 |
| 10 | package sets |
| 11 | |
| 12 | import ( |
| 13 | "github.com/emirpasic/gods/v2/containers" |
| 14 | ) |
| 15 | |
| 16 | // Set interface that all sets implement |
| 17 | type Set[T comparable] interface { |
| 18 | Add(elements ...T) |
| 19 | Remove(elements ...T) |
| 20 | Contains(elements ...T) bool |
| 21 | |
| 22 | containers.Container[T] |
| 23 | // Empty() bool |
| 24 | // Size() int |
| 25 | // Clear() |
| 26 | // Values() []interface{} |
| 27 | // String() string |
| 28 | } |