Learn Data Structures and Algorithms with Golang
上QQ阅读APP看书,第一时间看更新

The ContainsElement method

The ContainsElement method of the Set class checks whether or not the element exists in integerMap. The integerMap element is looked up with a key integer element, as shown in the following code example:


//checks if element is in the set
func (set *Set) ContainsElement(element int) bool{
var exists bool
_, exists = set.integerMap[element]
return exists
}