Added a toSet method for testing arrays.