Files
hello-algo/en/codes/dart/utils/vertex.dart
Yudong Jin 14c314c08c Retranslate the complete English edition from Simplified Chinese (#2010)
* Retranslate the complete English edition from Simplified Chinese

* Polish three English explanations after reader-focused review
2026-10-31 03:35:51 +08:00

30 lines
631 B
Dart

/**
* File: Vertex.dart
* Created Time: 2023-05-15
* Author: liuyuxin (gvenusleo@gmail.com)
*/
/* Vertex class */
class Vertex {
int val;
Vertex(this.val);
/* Given the list of values vals, return the list of vertices vets */
static List<Vertex> valsToVets(List<int> vals) {
List<Vertex> vets = [];
for (int i in vals) {
vets.add(Vertex(i));
}
return vets;
}
/* Given the list of vertices vets, return the list of values vals */
static List<int> vetsToVals(List<Vertex> vets) {
List<int> vals = [];
for (Vertex vet in vets) {
vals.add(vet.val);
}
return vals;
}
}