Uh oh!
There was an error while loading. Please reload this page.
[SPARK-13702][CORE][SQL][MLLIB] Use diamond operator for generic instance creation in Java code. - #11541
[SPARK-13702][CORE][SQL][MLLIB] Use diamond operator for generic instance creation in Java code.#11541dongjoon-hyun wants to merge 2 commits into
Conversation
srowen
commented
Mar 6, 2016
Although I personally like this change, I'm less certain about it since it does not add any functional improvement or avoid a potential bug. It does add a little readability and only touches the relatively fewer Java files. I'd like to wait for others to give an opinion. |
dongjoon-hyun
commented
Mar 6, 2016
Thank you for review, @srowen . |
dongjoon-hyun
commented
Mar 8, 2016
mengxr
commented
Mar 8, 2016
+1 on the code changes, which simplifies the Java code and shows some benefits from dropping Java 6, but the changes to the pom file should be discussed in a separate PR. |
mengxr
commented
Mar 8, 2016
add to whitelist |
mengxr
commented
Mar 8, 2016
ok to test |
dongjoon-hyun
commented
Mar 8, 2016
Thank you, @mengxr ! |
…ance 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); ```
dongjoon-hyun
commented
Mar 8, 2016
Hi, @mengxr . |
SparkQA
commented
Mar 9, 2016
Test build #52697 has finished for PR 11541 at commit
|
SparkQA
commented
Mar 9, 2016
Test build #52699 has finished for PR 11541 at commit
|
dongjoon-hyun
commented
Mar 9, 2016
Hi, @mengxr . |
SparkQA
commented
Mar 9, 2016
Test build #52696 has finished for PR 11541 at commit
|
dongjoon-hyun
commented
Mar 9, 2016
The latest one is at commit |
srowen
commented
Mar 9, 2016
LGTM, merging to master. This is now just straightforward use of the diamond operator only. |
dongjoon-hyun
commented
Mar 9, 2016
Thank you, @srowen . Yes, it is. |
…ance creation in Java code. ## What changes were proposed in this pull request? In order to make `docs/examples` (and other related code) more simple/readable/user-friendly, this PR replaces existing codes like the followings by using `diamond` operator. ``` - final ArrayList<Product2<Object, Object>> dataToWrite = - new ArrayList<Product2<Object, Object>>(); + final ArrayList<Product2<Object, Object>> dataToWrite = new ArrayList<>(); ``` 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. ## How was this patch tested? Manual. Pass the existing tests. Author: Dongjoon Hyun <dongjoon@apache.org> Closesapache#11541 from dongjoon-hyun/SPARK-13702.
What changes were proposed in this pull request?
In order to make
docs/examples(and other related code) more simple/readable/user-friendly, this PR replaces existing codes like the followings by usingdiamondoperator.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.
How was this patch tested?
Manual.
Pass the existing tests.