---
title: "Discussion on \"When NOT to use Collectors.toMap()\" | Hashnode"
description: "Discussion on \"When NOT to use Collectors.toMap()\". In this article, we will see when not to use Collectors.toMap() in Java programming and how it can cause us NullPointerException.\nIntroduction\nLet's try to recall what is a HashMap in Java and what are its properties. In Java HashMap is a collection ..."
url: "https://hashnode.com/posts/when-not-to-use-collectorstomap/646bc24950cde4adfd617132"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [When NOT to use Collectors.toMap()](https://himanshurai.hashnode.dev/when-not-to-use-collectorstomap?utm_source=hashnode&utm_medium=feed)

In this article, we will see when not to use Collectors.toMap() in Java programming and how it can cause us NullPointerException. Introduction Let's try to recall what is a HashMap in Java and what are its properties. In Java HashMap is a collection ...

May 22, 2023 · 3 min read · himanshurai.hashnode.dev  
Read the article

-   [#programming-blogs](https://hashnode.com/tag/programming-blogs)
-   [#software-development](https://hashnode.com/tag/software-development)
-   [#java](https://hashnode.com/tag/java)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Himanshu Rai](https://hashnode.com/@himanshunitrr)

@himanshunitrr · Hyderabad India

  
[View profile](https://hashnode.com/@himanshunitrr)

Software Developer

I am a developer from Hyderabad India. I am new to writing blogs having started this blog in April 2023. I will be writing mostly on java, spring, spring boot as well as language agnostic topics like algorithms, DB, how things work under the hood etc.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
