lolita
lolita

Reputation: 489

Intellij can not recognize java.util.List

When I input List in Intellij, it doesn't automatically provide a prompt for importing java.util. I have to import java.util.List manually.

When I write java.util, it doesn't prompt to add List, but instead ArrayList.

Upvotes: 42

Views: 24865

Answers (5)

Rutwick Gangurde
Rutwick Gangurde

Reputation: 4912

If anyone faces this issue in Netbeans, The answer @AyushDhakal works, closing and reopening Netbeans fixes the error.

Upvotes: 0

Aayush Dhakal
Aayush Dhakal

Reputation: 41

Reopening the project fixes the auto-import for me.

Upvotes: 3

user22459090
user22459090

Reputation:

There are few issues in code completion in versions 2022 and above. of course manually import the package sort the issue. Based on my understanding the issue reproduced the time the UI is busy updating maven indexes especially when memory is low

Upvotes: 0

Peter Gromov
Peter Gromov

Reputation: 18911

Please check File | Settings | Editor | General | Auto Import | Exclude from Import and Completion. If java.util.List is there, remove it.

Upvotes: 113

womd
womd

Reputation: 3443

in my case, suddenly nothing from java.* was recognized. tried setting different JDK's in File->ProjectStructure, then File->Invalidate Caches/Restart made it work again!

Upvotes: 10

Related Questions