Java Collections variable parameters and use tools to understand

Today, after the discovery jdk1.5 increased variable parameters, previously also been not know

public  static  void main (String [] args) { 
        System.out.println (getNum ( 1,2,3,4,5 )); 
    } 
    
    / * 
     * 1. Up to a function a variable parameter, the variable parameter release other parameters in the 
     variable parameter * 2.Java compile-time will be compiled into an array 
     * / 
    public  static  int getNum ( int ... a) {
         int SUM = 0 ;
         for ( int I: a) { 
            SUM = SUM + I; 
        } 
        return SUM; 
    }

In addition, the brush algorithm problem seen in the discussion area of ​​api Collections of useful tools for assisting resolved, api for Collecitons of how not used, not very understanding, look at the Nuggets jdk8 document + a blog on the clear

https://juejin.im/post/5a752b1c5188257a73499bb5#heading-1

Guess you like

Origin www.cnblogs.com/zengcongcong/p/11298629.html