Write a method for the List class that checks whether the list contains a loop. Your method should be linear in the number of nodes.