summaryrefslogtreecommitdiff
path: root/src/pkg/container/vector/stringvector.go
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
committerRobert Griesemer <gri@golang.org>2009-11-06 14:24:38 -0800
commit828334dd95ce8e4bf3662bd5c89d7c417f0741d0 (patch)
treefd7e0c9961bc3af2ddf105e9cc1943f2509ac584 /src/pkg/container/vector/stringvector.go
parenteb5cdfd67ff6d32df4c4c27840eaee027c5e3512 (diff)
downloadgolang-828334dd95ce8e4bf3662bd5c89d7c417f0741d0.tar.gz
- fine-tuning of one-line func heuristic (nodes.go)
- enabled for function declarations (not just function literals) - applied gofmt -w $GOROOT/src (look for instance at src/pkg/debug/elf/elf.go) R=r, rsc CC=go-dev http://go/go-review/1026006
Diffstat (limited to 'src/pkg/container/vector/stringvector.go')
-rw-r--r--src/pkg/container/vector/stringvector.go28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/pkg/container/vector/stringvector.go b/src/pkg/container/vector/stringvector.go
index 4e54ea85c..c3f31f046 100644
--- a/src/pkg/container/vector/stringvector.go
+++ b/src/pkg/container/vector/stringvector.go
@@ -20,27 +20,19 @@ func (p *StringVector) Init(len int) *StringVector {
// NewStringVector returns an initialized new StringVector with length at least len.
-func NewStringVector(len int) *StringVector {
- return new(StringVector).Init(len);
-}
+func NewStringVector(len int) *StringVector { return new(StringVector).Init(len) }
// At returns the i'th element of the vector.
-func (p *StringVector) At(i int) string {
- return p.Vector.At(i).(string);
-}
+func (p *StringVector) At(i int) string { return p.Vector.At(i).(string) }
// Set sets the i'th element of the vector to value x.
-func (p *StringVector) Set(i int, x string) {
- p.a[i] = x;
-}
+func (p *StringVector) Set(i int, x string) { p.a[i] = x }
// Last returns the element in the vector of highest index.
-func (p *StringVector) Last() string {
- return p.Vector.Last().(string);
-}
+func (p *StringVector) Last() string { return p.Vector.Last().(string) }
// Data returns all the elements as a slice.
@@ -75,15 +67,11 @@ func (p *StringVector) Slice(i, j int) *StringVector {
// Push appends x to the end of the vector.
-func (p *StringVector) Push(x string) {
- p.Vector.Push(x);
-}
+func (p *StringVector) Push(x string) { p.Vector.Push(x) }
// Pop deletes and returns the last element of the vector.
-func (p *StringVector) Pop() string {
- return p.Vector.Pop().(string);
-}
+func (p *StringVector) Pop() string { return p.Vector.Pop().(string) }
// AppendVector appends the entire StringVector x to the end of this vector.
@@ -94,9 +82,7 @@ func (p *StringVector) AppendVector(x *StringVector) {
// sort.Interface support
// Less returns a boolean denoting whether the i'th element is less than the j'th element.
-func (p *StringVector) Less(i, j int) bool {
- return p.At(i) < p.At(j);
-}
+func (p *StringVector) Less(i, j int) bool { return p.At(i) < p.At(j) }
// Iterate over all elements; driver for range