import collections


def are_lists_equal(list1, list2):
    """
    Checks whether two lists are equal (contain exactly the same elements).
    Using Counter data structure allows duplicates to be considered i.e. [1, 1, 2]  != [1, 2].
    :param list1: the first list.
    :param list2: the second list.
    :return: true if the two lists contain exactly the same elements.
    """
    return collections.Counter(list1) == collections.Counter(list2)