github.com/m4gshm/gollections@v0.0.10/collection/filter/api.go (about)

     1  // Package filter provides aliases for collections filtering helpers
     2  package filter
     3  
     4  import (
     5  	"github.com/m4gshm/gollections/c"
     6  	"github.com/m4gshm/gollections/collection"
     7  	"github.com/m4gshm/gollections/stream"
     8  )
     9  
    10  // AndConvert - filter.AndConvert is short alias of collection.FilterAndConvert
    11  func AndConvert[From, To any, IT c.Iterable[From]](elements IT, filter func(From) bool, converter func(From) To) stream.Iter[To] {
    12  	return collection.FilterAndConvert(elements, filter, converter)
    13  }
    14  
    15  // ConvertFilter - filter.ConvertFilter is short alias of slice.FilterConvertFilter
    16  func ConvertFilter[From, To any, IT c.Iterable[From]](elements IT, filterFrom func(From) bool, converter func(From) To, filterTo func(To) bool) stream.Iter[To] {
    17  	return collection.FilterAndConvert(elements, filterFrom, converter).Filter(filterTo)
    18  }