-
Notifications
You must be signed in to change notification settings - Fork 6
Home
daviddengcn edited this page Nov 21, 2012
·
2 revisions
Some helper structs for go-lang
ArrayList is a list of values(in the form of interface{}).
Usage:
lst := villa.NewArrayList()
lst.Add(10)
lst.Add(20)
lst.Insert(1, 30)
l := lst.Len()
sort.Sort(lst.NewLessAdapter(func(e1, e2 interface{}) bool {
return e1.(int) < e2.(int)
}))
Usage:
pq := villa.NewPriorityQueue(func(e1, e2 interface{}) bool {
return e1.(int32) < e2.(int32)
})
pq.Push(10)
pq.Push(20)
vl := pq.Pop()