// Filter filters the specified string slice with the specified function.
968941
func Filter(vs []string, f func(string) bool) []string {
	r := make([]string, 0, len(vs))
	for _, v := range vs {
		if f(v) {
			r = append(r, v)
		}
	}
	return r
}
925657
func (m *RouteMux) Filter(filter http.HandlerFunc) {
	m.filters = append(m.filters, filter)
}
704967
func (k *KeyBindings) Filter(kp KeyPress) (ret KeyBindings) {
	p := Prof.Enter("key.filter")
	defer p.Exit()

	kp.fix()
	k.DropLessEqualKeys(k.seqIndex)
	ret.seqIndex = k.seqIndex + 1
	ki := kp.Index()

	k.filter(ki, &ret)

	if kp.IsCharacter() {
		k.filter(int(Any), &ret)
	}
	return
}
85402
func (s *Set) Filter(fn func(interface{}) bool) *Set {
	// Create a set to return with elements which match filter function
	filterSet := New()

	// Enumerate all elements and apply the function
	for _, e := range s.Enumerate() {
		// Apply the function, add elements which it matches
		if fn(e) {
			filterSet.Add(e)
		}
	}

	return filterSet
}
963372
func (r *report) filter(cum bool, focus *regexp.Regexp) []string {
	r.mu.Lock()
	defer r.mu.Unlock()
	if r.p == nil {
		return nil
	}
	c := r.p.Copy()
	c.FilterSamplesByName(focus, nil, nil)
	rpt := goreport.NewDefault(c, goreport.Options{
		OutputFormat:   goreport.Text,
		CumSort:        cum,
		PrintAddresses: true,
	})
	buf := bytes.NewBuffer(nil)
	goreport.Generate(buf, rpt, nil)
	return strings.Split(buf.String(), "\n")
}
552896
func (s *NestedSort) Filter(filter Query) *NestedSort {
	s.filter = filter
	return s
}
820668
func (t *Table) Filter(f func(Row) bool) {
	t.mu.Lock()
	defer t.mu.Unlock()
	var newData []Row
	for _, r := range t.Data {
		if !f(r) {
			newData = append(newData, r)
		}
	}
	t.Data = newData
}
268866
func Filter(chains [][]*x509.Certificate, f RankingFunc) [][]*x509.Certificate {
	// If there are no chain or only 1 chain, we are done.
	if len(chains) <= 1 {
		return chains
	}

	bestChain := chains[0]
	var candidateChains [][]*x509.Certificate
	for _, chain := range chains {
		r := f(bestChain, chain)
		if r < 0 {
			bestChain = chain
			candidateChains = [][]*x509.Certificate{chain}
		} else if r == 0 {
			candidateChains = append(candidateChains, chain)
		}
	}
	return candidateChains
}
975453
func (p *aeBackupKindQueryProperty) Filter(op string, value interface{}) *aeBackupKindQueryBuilder {
	switch op {
	case "<=":
		p.LessThanOrEqual(value)
	case ">=":
		p.GreaterThanOrEqual(value)
	case "<":
		p.LessThan(value)
	case ">":
		p.GreaterThan(value)
	case "=":
		p.Equal(value)
	default:
		p.bldr.q = p.bldr.q.Filter(p.name+" "+op, value) // error raised by native query
	}
	if p.bldr.plugin != nil {
		p.bldr.plugin.Filter(p.name, op, value)
	}
	return p.bldr
}
371973
func Filter(elements map[string]interface{}, keys ...string) map[string]interface{} {
	var keyIdx = make(map[string]bool)
	var result = make(map[string]interface{})

	for _, key := range keys {
		keyIdx[key] = true
	}

	for k, e := range elements {
		if _, ok := keyIdx[k]; !ok {
			result[k] = e
		}
	}

	return result
}
555491
func (a *FiltersAggregation) Filter(filter Query) *FiltersAggregation {
	a.unnamedFilters = append(a.unnamedFilters, filter)
	return a
}
743361
func (c Checkout) Filter(whiteset stringset.Set) Checkout {
	newCheckout := make(Checkout)
	for repo, commit := range c {
		if whiteset.Has(repo) {
			newCheckout[repo] = commit
		}
	}
	return newCheckout
}
925524
func Filter(slice []string, handler func(string) bool) []string {
	filtered := []string{}
	for _, element := range slice {
		if handler(element) {
			filtered = append(filtered, element)
		}
	}
	return filtered
}
625321
func (p *Predict) filter(list []string, prefix string) []string {
	var predictions []string
	for _, item := range list {
		if strings.HasPrefix(item, prefix) {
			predictions = append(predictions, item)
		}
	}
	return predictions
}
635558
func (s *IndicesAnalyzeService) Filter(filter ...string) *IndicesAnalyzeService {
	s.request.Filter = filter
	return s
}
510914
func (b *BoolQueryBuilder) Filter() *FilterQueryBuilder {
	if b.filterQueryBuilder == nil {
		b.filterQueryBuilder = NewFilterQueryBuilder()
	}
	return b.filterQueryBuilder
}
589496
func Filter(src string, filter func(int, []byte) error) error {
	return Read(src, func(fd *os.File) (err error) {
		return io2.FilterRead(fd, filter)
	})
}