Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Difference between "new HashSet<>(1)" with "new HashSet<>()"? #17

@JarenFeng

Description

@JarenFeng

I noticed that you used the new HashSet<>(1) instead of new HashSet<>() to initialize a HashSet,is there any profits by doing that?

I read the source code and find that new HashSet<>(1) or new HashSet<>() neither really initialize a HashMapEntry array,it's initialized when method V put(K,V) was first called by void inflateTable(int size).

AM I WRONG OR MISSED?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions