Teams. Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. So basically the map is already being re-used if you use it properly within a stream. If you would make the map static, the map would be shared for all usages. So if you have two streams using this distinctByKey, both would use the same map, which isn't what you want. –.