You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yang Jie (Jira)" <ji...@apache.org> on 2023/10/11 07:09:00 UTC

[jira] [Created] (SPARK-45501) Use pattern matching for type checking and conversion

Yang Jie created SPARK-45501:
--------------------------------

             Summary: Use pattern matching for type checking and conversion
                 Key: SPARK-45501
                 URL: https://issues.apache.org/jira/browse/SPARK-45501
             Project: Spark
          Issue Type: Sub-task
          Components: Spark Core, SQL
    Affects Versions: 4.0.0
            Reporter: Yang Jie


Refer to [JEP 394|https://openjdk.org/jeps/394]

Example:
{code:java}
if (obj instanceof String) {
    String str = (String) obj;
    System.out.println(str);
} {code}

Can be replaced with

 
{code:java}
if (obj instanceof String str) {
    System.out.println(str);
} {code}
The new code look more compact



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org