本文整理汇总了Golang中container/list.List.PushBackList方法的典型用法代码示例。如果您正苦于以下问题:Golang List.PushBackList方法的具体用法?Golang List.PushBackList怎么用?Golang List.PushBackList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类container/list.List
的用法示例。
在下文中一共展示了List.PushBackList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: outOfOrder
func outOfOrder(l *list.List) {
iTotal := 25
if iTotal > l.Len() {
iTotal = l.Len()
}
ll := make([]*list.List, iTotal)
for i := 0; i < iTotal; i++ {
ll[i] = list.New()
}
r := rand.New(rand.NewSource(time.Now().UnixNano()))
for e := l.Front(); e != nil; e = e.Next() {
fpath, ok := e.Value.(string)
if !ok {
panic("The path is invalid string")
}
if rand.Int()%2 == 0 {
ll[r.Intn(iTotal)].PushFront(fpath)
} else {
ll[r.Intn(iTotal)].PushBack(fpath)
}
}
r0 := rand.New(rand.NewSource(time.Now().UnixNano()))
l.Init()
for i := 0; i < iTotal; i++ {
if r0.Intn(2) == 0 {
l.PushBackList(ll[i])
} else {
l.PushFrontList(ll[i])
}
ll[i].Init()
}
}
示例2: GetAllItems
// GetAllItems fill the list itemList with all items in the tree.
func (this *quadTreeNode) GetAllItems(itemList *list.List) {
itemList.PushBackList(this.items)
if this.isPartitioned {
this.topLeftNode.GetAllItems(itemList)
this.topRightNode.GetAllItems(itemList)
this.bottomLeftNode.GetAllItems(itemList)
this.bottomRightNode.GetAllItems(itemList)
}
}
示例3: GetItems
// Fill itemList with all items that could collide with the given Rect.
func (this *quadTreeNode) GetItems(itemList *list.List, rect *Rect) {
var node *quadTreeNode = nil
var err bool = false
if this.isPartitioned {
node, err = this.GetNode(rect)
if !err {
node.GetItems(itemList, rect)
} else if err {
this.GetAllItems(itemList)
}
}
itemList.PushBackList(this.items)
}
示例4: FindChildren
func FindChildren(n *html.Node, predicate func(*html.Node) bool) list.List {
results := list.List{}
if predicate(n) {
results.PushBack(n)
}
for c := n.FirstChild; c != nil; c = c.NextSibling {
inner_results := FindChildren(c, predicate)
if inner_results.Len() > 0 {
results.PushBackList(&inner_results)
}
}
return results
}