[
https://issues.apache.org/jira/browse/SPARK-13702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15181913#comment-15181913
]
Apache Spark commented on SPARK-13702:
--------------------------------------
User 'dongjoon-hyun' has created a pull request for this issue:
https://github.com/apache/spark/pull/11541
> Use diamond operator for generic instance creation in Java code
> ---------------------------------------------------------------
>
> Key: SPARK-13702
> URL: https://issues.apache.org/jira/browse/SPARK-13702
> Project: Spark
> Issue Type: Improvement
> Reporter: Dongjoon Hyun
> Priority: Trivial
>
> 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.
> {code}
> -List<JavaPairDStream<String, String>> kafkaStreams = new
> ArrayList<JavaPairDStream<String, String>>(numStreams);
> +List<JavaPairDStream<String, String>> kafkaStreams = new
> ArrayList<>(numStreams);
> {code}
> {code}
> -Set<Tuple2<Integer, Integer>> edges = new HashSet<Tuple2<Integer,
> Integer>>(numEdges);
> +Set<Tuple2<Integer, Integer>> edges = new HashSet<>(numEdges);
> {code}
> *Reference*
> https://docs.oracle.com/javase/8/docs/technotes/guides/language/type-inference-generic-instance-creation.html
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]