# Methods of the Collection interface

Figure below shows the methods of the Collection interface, grouped by their functionality: methods that modify Collection, methods that query it, and miscellaneous.

![Methods defined in the Collection interface, grouped by their functionality](https://2172743581-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-La4k4liN--SZ6ay4iod%2F-LfZy3tl873rQZ7YWjdt%2F-Lf_2QBSSu9jdZAr7l_Q%2FScreenshot%202019-05-23%20at%207.47.08%20PM.png?alt=media\&token=e7523ecd-08ea-413b-b2ac-7923df6bc80c)

Because most of the interfaces implement the Collection interface, most of the imple- mentation classes include methods to add, remove, and query its elements and retrieve an Iterator to retrieve the collection elements. The implementation, though, varies across classes.

As you proceed and work with the implementation of classes in the collection framework, you’ll notice that almost all the classes mention that the Iterator returned by method iterator() is fail-fast. This implies that if you try to modify the structure of a collection by adding or removing elements from it, after the Iterator is created, the Iterator will throw the exception ConcurrentModificationException. But this doesn’t happen if you modify the collection by using the Iterator’s own add or remove methods. This important behavior prevents collections from returning arbitrary values during concurrent access.

As we move on to the next section to discuss more interfaces (namely, Set, List, and Deque), you’ll notice how each of them might suggest a different implementation of the methods from the Collection interface, to support the specific data structure that they represent.
