OSDN Git Service

Hulk did something
[bytom/vapor.git] / vendor / github.com / hashicorp / go-version / version_collection.go
diff --git a/vendor/github.com/hashicorp/go-version/version_collection.go b/vendor/github.com/hashicorp/go-version/version_collection.go
new file mode 100644 (file)
index 0000000..cc888d4
--- /dev/null
@@ -0,0 +1,17 @@
+package version
+
+// Collection is a type that implements the sort.Interface interface
+// so that versions can be sorted.
+type Collection []*Version
+
+func (v Collection) Len() int {
+       return len(v)
+}
+
+func (v Collection) Less(i, j int) bool {
+       return v[i].LessThan(v[j])
+}
+
+func (v Collection) Swap(i, j int) {
+       v[i], v[j] = v[j], v[i]
+}