Skip to content

Documentation is wrong about immutability #965

@DarioViva42

Description

@DarioViva42

public static <T> Set<T> asSet(Collection<T> c) {

You tell users, that asSet returns an immutable Set.

@return a type-safe immutable {@code Set} containing the specified collection elements.

This is not true, when you pass in a mutable Set. In this case the Collection is only cast to a Set. You probably want to change the documentation or use java.util.Collections.unmodifiableSet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions