---
title: "Discussion on \"Gotchas in Java\" | Hashnode"
description: "Discussion on \"Gotchas in Java\". These are some pitfalls that took me some time to unravel.\n\nI used to think .collect(Collectors.toList()) and .toList() are same and interchangeable.\n But first one creates a mutable list and second one creates a immutable list\n         List<Integer>..."
url: "https://hashnode.com/posts/gotchas-in-java/659f8a317a1baa7e7938a02c"
---

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

Discussion

# [Gotchas in Java](https://kcterala.hashnode.dev/gotchas-in-java?utm_source=hashnode&utm_medium=feed)

These are some pitfalls that took me some time to unravel. I used to think .collect(Collectors.toList()) and .toList() are same and interchangeable. But first one creates a mutable list and second one creates a immutable list List<Integer>...

Jan 11, 2024 · 1 min read · kcterala.hashnode.dev  
Read the article

-   [#java](https://hashnode.com/tag/java)
-   [#miscellaneous](https://hashnode.com/tag/miscellaneous)

## Written by

[Krishna Chaitanya Terala](https://hashnode.com/@kcterala)

@kcterala

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

Full stack Engineer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
