ContainsExactly

ContainsExactly[e1,e2]

yields True if e1 contains exactly the same elements as e2.

ContainsExactly[e2]

is an operator form that yields True when the object to which it is applied contains exactly the same elements as e2.

Examples

open allclose all

Basic Examples  (2)

Both lists contain exactly the same elements:

The lists contain different elements:

Scope  (4)

Check whether certain chemicals contain exactly certain elements:

Use ContainsExactly in operator form:

Find music works composed in 1982 by Bernie Taupin and Elton John:

ContainsExactly works with associations:

Options  (2)

SameTest  (2)

By default, ContainsExactly considers elements to be the same if they are identical:

Changes of units are taken into account, as long as they represent the exact same quantity:

Numerical approximations are not considered as the same object:

Use Equal as the comparison function to have numerical tolerance:

String comparisons are case sensitive by default:

Convert to lower case before comparing:

Properties & Relations  (3)

ContainsExactly[list1,list2] is equivalent to testing for equality as sets:

ContainsExactly is a symmetric function of its arguments. That is, ContainsExactly[list1,list2]==ContainsExactly[list2,list1]:

ContainsExactly[list1,list2] is equivalent to And[ContainsAll[list1,list2],ContainsOnly[list1,list2]]:

Introduced in 2015
 (10.2)