From bc8f6adec9dc86321ad0edf10cef4a48bc2c615b Mon Sep 17 00:00:00 2001 From: a very fake floordiv Date: Tue, 8 Nov 2022 21:55:29 +0100 Subject: [PATCH] updated docstrings updated docstrings describing Set interface methods to start with a method name for a correct documentation generation (and avoiding tons of warnings in goland) --- set.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/set.go b/set.go index ddd6d4e..9fc3653 100644 --- a/set.go +++ b/set.go @@ -39,26 +39,26 @@ package mapset // represents an unordered set of data and a large number of // operations that can be applied to that set. type Set[T comparable] interface { - // Adds an element to the set. Returns whether + // Add adds an element to the set. Returns whether // the item was added. Add(val T) bool - // Returns the number of elements in the set. + // Cardinality returns the number of elements in the set. Cardinality() int - // Removes all elements from the set, leaving + // Clear removes all elements from the set, leaving // the empty set. Clear() - // Returns a clone of the set using the same + // Clone returns a clone of the set using the same // implementation, duplicating all keys. Clone() Set[T] - // Returns whether the given items + // Contains returns whether the given items // are all in the set. Contains(val ...T) bool - // Returns the difference between this set + // Difference returns the difference between this set // and other. The returned set will contain // all elements of this set that are not also // elements of other. @@ -69,7 +69,7 @@ type Set[T comparable] interface { // panic. Difference(other Set[T]) Set[T] - // Determines if two sets are equal to each + // Equal determines if two sets are equal to each // other. If they have the same cardinality // and contain the same elements, they are // considered equal. The order in which @@ -80,7 +80,7 @@ type Set[T comparable] interface { // method. Otherwise, Equal will panic. Equal(other Set[T]) bool - // Returns a new set containing only the elements + // Intersect returns a new set containing only the elements // that exist only in both sets. // // Note that the argument to Intersect @@ -89,7 +89,7 @@ type Set[T comparable] interface { // panic. Intersect(other Set[T]) Set[T] - // Determines if every element in this set is in + // IsProperSubset determines if every element in this set is in // the other set but the two sets are not equal. // // Note that the argument to IsProperSubset @@ -98,7 +98,7 @@ type Set[T comparable] interface { // will panic. IsProperSubset(other Set[T]) bool - // Determines if every element in the other set + // IsProperSuperset determines if every element in the other set // is in this set but the two sets are not // equal. // @@ -108,7 +108,7 @@ type Set[T comparable] interface { // panic. IsProperSuperset(other Set[T]) bool - // Determines if every element in this set is in + // IsSubset determines if every element in this set is in // the other set. // // Note that the argument to IsSubset @@ -117,7 +117,7 @@ type Set[T comparable] interface { // panic. IsSubset(other Set[T]) bool - // Determines if every element in the other set + // IsSuperset determines if every element in the other set // is in this set. // // Note that the argument to IsSuperset @@ -126,26 +126,26 @@ type Set[T comparable] interface { // panic. IsSuperset(other Set[T]) bool - // Iterates over elements and executes the passed func against each element. + // Each iterates over elements and executes the passed func against each element. // If passed func returns true, stop iteration at the time. Each(func(T) bool) - // Returns a channel of elements that you can + // Iter returns a channel of elements that you can // range over. Iter() <-chan T - // Returns an Iterator object that you can + // Iterator returns an Iterator object that you can // use to range over the set. Iterator() *Iterator[T] - // Remove a single element from the set. + // Remove removes a single element from the set. Remove(i T) - // Provides a convenient string representation + // String provides a convenient string representation // of the current state of the set. String() string - // Returns a new set with all elements which are + // SymmetricDifference returns a new set with all elements which are // in either this set or the other set but not in both. // // Note that the argument to SymmetricDifference @@ -154,7 +154,7 @@ type Set[T comparable] interface { // will panic. SymmetricDifference(other Set[T]) Set[T] - // Returns a new set with all elements in both sets. + // Union returns a new set with all elements in both sets. // // Note that the argument to Union must be of the // same type as the receiver of the method. @@ -164,7 +164,7 @@ type Set[T comparable] interface { // Pop removes and returns an arbitrary item from the set. Pop() (T, bool) - // Returns the members of the set as a slice. + // ToSlice returns the members of the set as a slice. ToSlice() []T // MarshalJSON will marshal the set into a JSON-based representation.