## Uses of Interface
java.util.Collection

- Packages that use Collection
  Package | Description
  --- | ---
  java.util |

- - ### Uses of Collection in java.util

    Subinterfaces of Collection in java.util
    Modifier and Type | Interface and Description
    --- | ---
    `interface` | `List<E>` An ordered collection (also known as a sequence).
    `interface` | `Set<E>` A collection that contains no duplicate elements.

    Methods in java.util that return Collection
    Modifier and Type | Method and Description
    --- | ---
    `Collection<V>` | Map.`values()` Returns a `Collection` view of the values contained in this map.

    Methods in java.util with parameters of type Collection
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | Set.`addAll(Collection<? extends E> c)` Adds all of the elements in the specified collection to this set if they're not already present (optional operation).
    `boolean` | List.`addAll(Collection<? extends E> c)` Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).
    `boolean` | Collection.`addAll(Collection<? extends E> c)` Adds all of the elements in the specified collection to this collection (optional operation).
    `boolean` | List.`addAll(int index, Collection<? extends E> c)` Inserts all of the elements in the specified collection into this list at the specified position (optional operation).
    `boolean` | Set.`containsAll(Collection<?> c)` Returns `true` if this set contains all of the elements of the specified collection.
    `boolean` | List.`containsAll(Collection<?> c)` Returns `true` if this list contains all of the elements of the specified collection.
    `boolean` | Collection.`containsAll(Collection<?> c)` Returns `true` if this collection contains all of the elements in the specified collection.
    `boolean` | Set.`removeAll(Collection<?> c)` Removes from this set all of its elements that are contained in the specified collection (optional operation).
    `boolean` | List.`removeAll(Collection<?> c)` Removes from this list all of its elements that are contained in the specified collection (optional operation).
    `boolean` | Collection.`removeAll(Collection<?> c)` Removes all of this collection's elements that are also contained in the specified collection (optional operation).
    `boolean` | Set.`retainAll(Collection<?> c)` Retains only the elements in this set that are contained in the specified collection (optional operation).
    `boolean` | List.`retainAll(Collection<?> c)` Retains only the elements in this list that are contained in the specified collection (optional operation).
    `boolean` | Collection.`retainAll(Collection<?> c)` Retains only the elements in this collection that are contained in the specified collection (optional operation).

Copyright © 2025 API Design. All Rights Reserved.