Merge pull request #61 from Spriithy/feature/list_constructors

Added bulk constructors for arraylists & (doubly)-linked-lists
This commit is contained in:
Emir Pasic
2018-09-20 18:23:21 +02:00
committed by GitHub
3 changed files with 21 additions and 0 deletions
+7
View File
@@ -37,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))