diff options
author | chai <chaifix@163.com> | 2021-06-24 19:55:26 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-06-24 19:55:26 +0800 |
commit | dbcd0c269014100b7d4cc421c5ab518f275cca09 (patch) | |
tree | 6564ca8a58b6921d4782bba3feae0ea787f9e1f4 /Assets/Algorithms/Algorithms.cs | |
parent | 2749e059084b99737d79aadd92521023b0f65f56 (diff) |
Diffstat (limited to 'Assets/Algorithms/Algorithms.cs')
-rw-r--r-- | Assets/Algorithms/Algorithms.cs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Assets/Algorithms/Algorithms.cs b/Assets/Algorithms/Algorithms.cs index a6005d3..7d51606 100644 --- a/Assets/Algorithms/Algorithms.cs +++ b/Assets/Algorithms/Algorithms.cs @@ -49,10 +49,21 @@ namespace AlgorithmCollection return v1.CompareTo(v2) < 0 ? v1 : v2;
}
+ public static T Max<T>(T v1, T v2) where T : IComparable
+ {
+ return v1.CompareTo(v2) > 0 ? v1 : v2;
+ }
+
public static string ListToString<T>(List<T> data)
{
string content = "";
- data.ForEach((T v) => { content += v.ToString(); });
+ //data.ForEach((T v) => { content += v.ToString(); });
+ for(int i = 0; i < data.Count; ++i)
+ {
+ content += data[i];
+ if (i != data.Count - 1)
+ content += ",";
+ }
return content;
}
|