spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Owen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-13702) Use diamond operator for generic instance creation in Java code
Date Sun, 06 Mar 2016 21:04:40 GMT

     [ https://issues.apache.org/jira/browse/SPARK-13702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sean Owen updated SPARK-13702:
------------------------------
    Component/s: Examples

> 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
>          Components: Examples
>            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: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message