Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsEmptyList ¶
Check if the list is empty. Return true if list is nil or length eq 0.
func IsNotEmptyList ¶
Check if the list is not empty. Return true only if the list has at least one element.
Types ¶
type ConcurrentMap ¶
type ConcurrentMap interface { // Maps the specified key to the specified value. // Neither the key nor the value can be nil. // The value can be retrieved by calling the get method with a key that is equal to the original key. Put(k interface{}, v interface{}) // If the specified key is not already associated with a value, // associate it with the given value. This is equivalent to // if (!map.containsKey(key)) // return map.put(key, value); // else // return map.get(key); PutIfAbsent(k interface{}, v interface{}) // Returns the value to which the specified key is mapped, // isExists value indicates whether this map contains mapping for the key. Get(k interface{}) (v interface{}, isExists bool) // Check if the map contains the key. ContainsKey(k interface{}) (isExists bool) // Return an slice of the keys in this container. Keys() []interface{} // Removes all of the mappings from this map. Clear() // Removes the key (and its corresponding value) from this map. Remove(k interface{}) // Returns the number of key-value mappings in this map. Size() int }
Threadsafe Map.
type Set ¶
type Set interface { // Returns the number of elements in this set (its cardinality). Size() int // Returns true if this set contains no elements. IsEmpty() bool // Returns true if this set contains the specified element. Contains(v interface{}) bool // Returns an slice containing all of the elements in this set. // The caller is free to modify the returned array. ToSlice() []interface{} // Adds the specified element to this set // Return true, if this set already contain the specified element Add(v interface{}) bool // Removes the specified element from this set // Return true, if this set contained the specified element Remove(v interface{}) bool // Removes all of the elements from this set. Clear() // Adds all elements in s into this set. Union(s Set) // Removes all elements not in s from this set. Intersect(s Set) // Removes all elements in s from this set. Subtract(s Set) // Returns true when all elements in this set are in s. IsSubset(s Set) bool // Returns true when two sets has the same elements. IsEqual(s Set) bool // Create a new set, and copy all the elements in this set. Clone() Set // Iterate the set elements and invoke f by every element. Foreach(f func(interface{})) // Create a new set, mapping the elements by call f. Map(f func(interface{}) interface{}) Set // Create a new set with all elements satisfied f. Filter(f func(interface{}) bool) Set }
A collection that contains no duplicate elements. Set is not thread safe.
Click to show internal directories.
Click to hide internal directories.