github.com/searKing/golang/go@v1.2.74/container/slice/count.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package slice 6 7 import ( 8 "github.com/searKing/golang/go/util/object" 9 ) 10 11 // CountFunc returns the maximum element of this stream according to the provided. 12 func CountFunc(s interface{}) int { 13 return countFunc(Of(s)) 14 15 } 16 17 // countFunc is the same as CountFunc 18 func countFunc(s []interface{}) int { 19 object.RequireNonNil(s, "countFunc called on nil slice") 20 return len(s) 21 }