GitHub user dongjoon-hyun opened a pull request:

    https://github.com/apache/spark/pull/11541

    [SPARK-13702][CORE][SQL][MLLIB] Use diamond operator for generic instance 
creation in Java code.

    ## What changes were proposed in this pull request?
    
    Java 7 or higher supports **diamond** operator which replaces the type 
arguments required to invoke the constructor of a generic class with an empty 
set of type parameters (<>). Currently, Spark Java code use mixed usage of 
this. This issue replaces existing codes to use `diamond` operator and add 
`Checkstyle` rule to help contributors.
    
    ```
    -List<JavaPairDStream<String, String>> kafkaStreams = new 
ArrayList<JavaPairDStream<String, String>>(numStreams);
    +List<JavaPairDStream<String, String>> kafkaStreams = new 
ArrayList<>(numStreams);
    -Set<Tuple2<Integer, Integer>> edges = new HashSet<Tuple2<Integer, 
Integer>>(numEdges);
    +Set<Tuple2<Integer, Integer>> edges = new HashSet<>(numEdges);
    ```
    
    ## How was this patch tested?
    
    Pass the existing tests and `./dev/lint-java` shows no error message for 
`diamond` operator.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/dongjoon-hyun/spark SPARK-13702

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/11541.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #11541
    
----
commit e0c20460b4e9454576864954b05806888d557c62
Author: Dongjoon Hyun <[email protected]>
Date:   2016-03-05T20:40:52Z

    [SPARK-13702][CORE][SQL][MLLIB] Use diamond operator for generic instance 
creation in Java code.
    
    Java 7 or higher supports `diamond` operator which replaces the type 
arguments required to invoke the constructor of a generic class with an empty 
set of type parameters (<>). Currently, Spark Java code use mixed usage of 
this. This issue replaces existing codes to use `diamond` operator and add 
Checkstyle rule.
    ```
    -List<JavaPairDStream<String, String>> kafkaStreams = new 
ArrayList<JavaPairDStream<String, String>>(numStreams);
    +List<JavaPairDStream<String, String>> kafkaStreams = new 
ArrayList<>(numStreams);
    -Set<Tuple2<Integer, Integer>> edges = new HashSet<Tuple2<Integer, 
Integer>>(numEdges);
    +Set<Tuple2<Integer, Integer>> edges = new HashSet<>(numEdges);
    ```

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to