import java.util.*;

public class GenericCollectionsTest {
  
  public static void main(String[] args) {

    List<String> ls = new ArrayList<String>();
    
    ls.add("Hello");
    ls.add("how");
    ls.add("are");
    ls.add("you");
    ls.add("today");
    
    // using iterator
    StringBuffer result = new StringBuffer();   
    Iterator<String> is = ls.iterator();
    while (is.hasNext()) {
      result.append(is.next().toUpperCase()).append(' ');
    }
    result.append('?');
    System.out.println(result);
    
    // using for-each loop
    result = new StringBuffer();
    for (String s : ls) {
        result.append(s.toLowerCase()).append(' ');
    }
    result.append('?');
    System.out.println(result);
  }
}