AllSame
Returns true if all elements in the collection have the same value, false otherwise.
- Use
reflect.ValueOf()to get the array or slice,Value.Index()andValue.Interface()to get the first value. - Use a
forloop withValue.Len()andValue.Index()to iterate over each element and compare it to the search value. - Return
falseif a non-matching value is found,trueotherwise.