Skip to content

Map#containsKey throws a NullPointerException when null is passed as the argument and the map is not empty #46

@DRobinson4105

Description

@DRobinson4105

Map<Integer, Integer> map = Map.of(); System.out.println(map.containsKey(null));

prints false

Map<Integer, Integer> map = Map.of(); map = map.put(1, 1); System.out.println(map.containsKey(null));

throws a NullPointerException

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions