[ 
https://issues.apache.org/jira/browse/FLINK-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14200714#comment-14200714
 ] 

ASF GitHub Bot commented on FLINK-1218:
---------------------------------------

Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/incubator-flink/pull/183#discussion_r19967614
  
    --- Diff: 
flink-examples/flink-java-examples/src/main/java/org/apache/flink/examples/java/graph/TransitiveClosureNaive.java
 ---
    @@ -63,8 +63,8 @@ public static void main (String... args) throws Exception{
                                         */
                                        public Tuple2<Long, Long> 
join(Tuple2<Long, Long> left, Tuple2<Long, Long> right) throws Exception {
                                                return new Tuple2<Long, Long>(
    -                                                           new 
Long(left.f0),
    -                                                           new 
Long(right.f1));
    +                                                           
Long.valueOf(left.f0),
    +                                                           
Long.valueOf(right.f1));
    --- End diff --
    
    It would be better to do this via
    `return new Tuple2<Long, Long>(left.f0, right.f1);`
    
    That avoids creating new boxed Longs entirely, just reusing the previous 
ones.


> Don't use "new Integer". Use "Integer.valueOf" instead.
> -------------------------------------------------------
>
>                 Key: FLINK-1218
>                 URL: https://issues.apache.org/jira/browse/FLINK-1218
>             Project: Flink
>          Issue Type: Bug
>    Affects Versions: 0.8-incubating
>            Reporter: Kousuke Saruta
>
> There are lots of "new Integer" or something line it in the code.
> We should use valueOf to avoid wasted instance creation.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to