Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new syntax of instanceof operator #1132

Open
gallandarakhneorg opened this issue Dec 18, 2023 · 0 comments
Open

Use the new syntax of instanceof operator #1132

gallandarakhneorg opened this issue Dec 18, 2023 · 0 comments

Comments

@gallandarakhneorg
Copy link
Member

JAva supports a new syntax for the instanceof that enables to avoid the implicit cast operator after the instanceof operator.

The new code is:

if (a instanceof T v) {
    ...v...
}

instead of:

if (a instanceof T) {
   T v = (T) a;
    ...v...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant