Lines Matching refs:list
495 func FirstUniquePaths(list Paths) Paths {
497 if len(list) > 128 {
498 return firstUniquePathsMap(list)
500 return firstUniquePathsList(list)
505 func SortedUniquePaths(list Paths) Paths {
506 unique := FirstUniquePaths(list)
513 func firstUniquePathsList(list Paths) Paths {
516 for i := 0; i < len(list); i++ {
518 if list[i] == list[j] {
522 list[k] = list[i]
525 return list[:k]
528 func firstUniquePathsMap(list Paths) Paths {
530 seen := make(map[Path]bool, len(list))
531 for i := 0; i < len(list); i++ {
532 if seen[list[i]] {
535 seen[list[i]] = true
536 list[k] = list[i]
539 return list[:k]
544 func LastUniquePaths(list Paths) Paths {
546 for i := len(list) - 1; i >= totalSkip; i-- {
549 if list[i] == list[j] {
552 list[j+skip] = list[j]
557 return list[totalSkip:]
561 func ReversePaths(list Paths) Paths {
562 if list == nil {
565 ret := make(Paths, len(list))
566 for i := range list {
567 ret[i] = list[len(list)-1-i]
572 func indexPathList(s Path, list []Path) int {
573 for i, l := range list {
582 func inPathList(p Path, list []Path) bool {
583 return indexPathList(p, list) != -1
586 func FilterPathList(list []Path, filter []Path) (remainder []Path, filtered []Path) {
587 return FilterPathListPredicate(list, func(p Path) bool { return inPathList(p, filter) })
590 func FilterPathListPredicate(list []Path, predicate func(Path) bool) (remainder []Path, filtered []…
591 for _, l := range list {