﻿using System.Collections.Generic;


namespace DirectoryContentSymlinker.Core.Utils
{
    public static class ArrayUtil
    {
        public static bool ArraysEqual<T>(T[] a1, T[] a2)
        {
            if (ReferenceEquals(a1, a2))
                return true;

            if (a1 == null || a2 == null)
                return false;

            if (a1.Length != a2.Length)
                return false;

            EqualityComparer<T> comparer = EqualityComparer<T>.Default;

            for (int i = 0; i < a1.Length; ++i)
            {
                if (!comparer.Equals(a1[i], a2[i])) return false;
            }

            return true;
        }
    }
}