Replace With var

Use quick intentions to replace a local variable type with `var`.

You can use ⌥⏎ (macOS) / Alt+Enter (Windows/Linux), to show context actions and replace the type on the left-hand side of the declaration with var (Java 10+). It's best to only do this when it's clear what the type the resulting object will be.


Related Resources

Extract Method
Extract Method
Extract code to a new method.
Inline Variable
Inline Variable
Sometimes inlining a variable can make your code more readable.
Introduce Variable
Introduce Variable
Refactor your code and introduce a new variable right when you need it.