Java --list summary of two common methods

/ * 
   Features List collection storage elements: 
     1.ing (List stores the set standard): What is the order of deposit into, or taken out in this order withdrawn 
     2. reusable 
* / 

public class ListTest02 { 
    
    public static void main (String [] args) { 
    
        // Create a set List 
         List new new L = the ArrayList (); 

        // add elements 
         l.add (100); 
         l.add (99); 
         l.add (23 is); 
         l.add ( 250); 
         l.add (250); 

         // a method of traversing 
        the Iterator l.iterator IT = (); 
        the while (it.hasNext ()) { 
        System.out.println (it.next ()); 
       } 
       // iterate method two: 
      for (int I; I <l.length; I ++) { 
          System.out.println (); 
           } 
  }

  

Guess you like

Origin www.cnblogs.com/ppp1314520818/p/12547275.html