本文整理匯總了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
}