Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: ulkir
Added: Jul 2, 2020 10:00 PM
Views: 182
  1.     public static void main(String[] args) {
  2.         List<String> lst = Arrays.asList("A", "B", "C", "D");
  3.         Iterator<String> itr = lst.iterator();
  4.         while (itr.hasNext()) {
  5.             String e = itr.next();
  6.             if (e == "C") {
  7.                 break;
  8.             } else {
  9. //                continue;
  10.                 System.out.println(e);
  11.             }
  12.         }
  13.     }