summaryrefslogtreecommitdiff
path: root/Assets/Algorithms/Algorithms.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Algorithms/Algorithms.cs')
-rw-r--r--Assets/Algorithms/Algorithms.cs13
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;
}