for traverses the collection (use the latest version after jdk1.5 is released)

"1" This is the collection found in the background:
List<User> userPhone = beforeApplyManageDao.getUserPhone();
<1> The traditional is for(int i = 0; i<userPhone.size(); i++){
            System.out .println("traverse each value ===" + userPhone.get(i));
 }
<2> After Jdk 1.5 comes out, the latest
   for(User us:userPhone){
          us.get....
   }
"2 》for(String str:list): The shortcut key is alt+/ 4th in the order (foreach -iterate over an array or Iterable)
    List<String> list=new ArrayList<String>();
    for(String str : list) {
     means assigning each element in the list to the String variable str;
    }
The shortcut key for this for(String str:list) is alt+/ the fourth one in the sequence (foreach -iterate over an array or Iterable)


 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326160280&siteId=291194637