Added bulk constructors for arraylists & (doubly)-linked-lists

This commit is contained in:
Spriithy
2017-09-28 14:22:00 +02:00
parent c4fc0ef8b1
commit 12451bdcc6
3 changed files with 27 additions and 3 deletions
+9 -1
View File
@@ -11,9 +11,10 @@ package arraylist
import (
"fmt"
"strings"
"github.com/emirpasic/gods/lists"
"github.com/emirpasic/gods/utils"
"strings"
)
func assertListImplementation() {
@@ -36,6 +37,13 @@ func New() *List {
return &List{}
}
// Of instantiates a new list of the given values
func Of(values ...interface{}) *List {
list := New()
list.Add(values)
return list
}
// Add appends a value at the end of the list
func (list *List) Add(values ...interface{}) {
list.growBy(len(values))