mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-01 17:47:24 +02:00
22 lines
500 B
C#
22 lines
500 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Robust.Shared.Utility;
|
|
|
|
public static class CollectionHelpers
|
|
{
|
|
public static bool ContainsDuplicates<T>(IReadOnlyList<T> list)
|
|
{
|
|
var comparer = EqualityComparer<T>.Default;
|
|
for (var i = 0; i < list.Count; i++)
|
|
{
|
|
for (var j = i + 1; j < list.Count; j++)
|
|
{
|
|
if (comparer.Equals(list[i], list[j]))
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|