aboutsummaryrefslogtreecommitdiff
path: root/src/pds.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-01-22 10:33:21 -0300
committerEuAndreh <eu@euandre.org>2025-01-22 10:33:21 -0300
commitd092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868 (patch)
treed86acb059602212063656b24f57af630c5cae148 /src/pds.go
parentsrc/pds.go: Use NewMapBuilder() in implementation of NewMapOf() (diff)
downloadpds-d092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868.tar.gz
pds-d092ca36e1c5fca9ab8bb6f4fd69aa1e3699e868.tar.xz
src/pds.go: Add NewVectorOf()
Diffstat (limited to '')
-rw-r--r--src/pds.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/pds.go b/src/pds.go
index 7f6e5d9..b853530 100644
--- a/src/pds.go
+++ b/src/pds.go
@@ -77,6 +77,15 @@ func (l *Vector[T]) clone() *Vector[T] {
return &other
}
+func NewVectorOf[T any](entries []T) *Vector[T] {
+ v := NewVectorBuilder[T]()
+ for _, x := range entries {
+ v.Append(x)
+ }
+
+ return v.Vector()
+}
+
// Len returns the number of elements in the vector.
func (l *Vector[T]) Len() int {
return l.size