func (b BySize) Len() int {
	return len(b)
}
Len returns the length of the list
package sorts
import (
	"fmt"
	"github.com/DataDrake/proc-maps/data"
	"os"
	"sort"
	"text/tabwriter"
)
type BySize []*data.FileEntry
func NewBySize(entries data.EntryMap) BySize {
	s := make(BySize, len(entries))
	i := 0
	for _, entry := range entries {
		s[i] = entry
		i++
	}
	sort.Sort(s)
	return s
}
func (b BySize) Print() {
	var total uint64
	for _, entry := range b {
		total += entry.Total
	}
	w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
	fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", "Rank", "Size (B)", "Cumulative Size (B)", "Filename")
	for i, entry := range b {
		fmt.Fprintf(w, "%d\t%s\t%s\t%s\n", i+1, data.CanonicalSize(entry.Total), data.CanonicalSize(total), entry.Name)
		total -= entry.Total
	}
	w.Flush()
}