Documentation
¶
Overview ¶
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Set ¶
type Set interface {
// Returns a new empty Set of the same type.
New() Set
// Returns a new Set that contains exactly the same elements as this set.
Copy() Set
// Returns the cardinality of this set.
Len() int
// Returns true if and only if this set contains v (according to Go equality rules).
Contains(v interface{}) bool
// Inserts v into this set.
Add(v interface{})
// Removes v from this set, if it is present. Returns true if and only if v was present.
Remove(v interface{}) bool
// Executes f(v) for every element v in this set. If f mutates this set, behavior is undefined.
Do(f func(interface{}))
// Executes f(v) once for every element v in the set, aborting if f ever returns false. If f
// mutates this set, behavior is undefined.
DoWhile(f func(interface{}) bool)
// Returns a channel from which each element in the set can be read exactly once. If this set
// is mutated before the channel is emptied, the exact data read from the channel is undefined.
Iter() <-chan interface{}
// Adds every element in s into this set.
Union(s Set)
// Removes every element not in s from this set.
Intersect(s Set)
// Removes every element in s from this set.
Subtract(s Set)
// Removes all elements from the set.
Init()
// Returns true if and only if all elements in this set are elements in s.
IsSubset(s Set) bool
// Returns true if and only if all elements in s are elements in this set.
IsSuperset(s Set) bool
// Returns true if and only if this set and s contain exactly the same elements.
IsEqual(s Set) bool
// Removes all elements v from this set that satisfy f(v) == true.
RemoveIf(f func(interface{}) bool)
}
An unordered collection of unique elements which supports lookups, insertions, deletions, iteration, and common binary set operations. It is not guaranteed to be thread-safe.
func NewKeyedSet ¶
func NewKeyedSet(keyf func(interface{}) interface{}, items ...interface{}) Set
Returns a new Set pre-populated with the given items
func NewSet ¶
func NewSet(items ...interface{}) Set
Returns a new Set pre-populated with the given items