title: Break statement doesn't work
body: <p>This is a small part of my code. Here the break statement doesn't work. The if condition is executed but the break statement takes the control to the start of the while loop. "assign" and "clsAssign" are two array list. "clustersRefGlobal()" is a function and I don't want to pass "assign" when it is empty. However due to break not working it is called even when "assign" is empty. I am not sure why break statement doesn't stop the while loop</p>
  
  <pre><code>   Wh:while (i &lt; n) {
          System.out.println("Start");
          get = clustersRefGlobal(assign);
          clsAssign.add(get.get(0));
          assign = get.get(1);
          if(assign.isEmpty()){
              System.out.println("Inside");
              break Wh;
          } 
          System.out.println("End");
          i++;
      }
  </code></pre>
  
  <p>Here is the output</p>
  
  <pre><code>Start
  
  End
  
  Start
  
  Inside
  
  Start
  
  Exception in thread "main" java.lang.NullPointerException
      at softwareClustering.DominantSetClustering.clustersRefGlobal(DominantSetClustering.java:54)
      at softwareClustering.DominantSetClustering.buildDominatSetClustering(DominantSetClustering.java:76)
      at trees.PrototypeSelectionTree.clustersRefLocal(PrototypeSelectionTree.java:214)
      at trees.PrototypeSelectionTree.clustersRefGlobal(PrototypeSelectionTree.java:180)
      at trees.PrototypeSelectionTree.buildTree(PrototypeSelectionTree.java:59)
      at trees.PrototypeSelectionTree.buildClassifier(PrototypeSelectionTree.java:235)
      at weka.classifiers.Evaluation.crossValidateModel(Evaluation.java:617)
      at trees.TestClassifier.main(TestClassifier.java:45)
  Java Result: 1
  </code></pre>
  
  <p>The exception is because the "clustersRefLocal()" function is called with empty "assign" parameter. If any one knows whats the problem or what I am missing?</p>
  
  <pre><code>public double[] buildDominatSetClustering(int n) throws Exception {
      int i = 1;
      ArrayList&lt;ArrayList&lt;Integer&gt;&gt; clsAssign = new ArrayList&lt;&gt;();
      ArrayList&lt;Integer&gt; assign = new ArrayList&lt;&gt;();
      ArrayList&lt;ArrayList&lt;Integer&gt;&gt; get;
      for (int j = 0; j &lt; data.numInstances(); j++) {
          assign.add(j);
      }
      Wh:
      while (i &lt; n) {
          System.out.println("hello");
          get = clustersRefGlobal(assign);
          clsAssign.add(get.get(0));
          assign = get.get(1);
          if(assign.isEmpty()){
              System.out.println("inside  "+assign.size());
              break Wh;
          } 
          System.out.println(assign.size());
          i++;
      }
      if(!assign.isEmpty())
      clsAssign.add(assign);
      double[] indexAssToClus = new double[data.numInstances()];
      int count = 0;
      for (ArrayList&lt;Integer&gt; a : clsAssign) {
          for (int k = 0; k &lt; a.size(); k++) {
              indexAssToClus[a.get(k)] = count;
          }
          count++;
      }
  return indexAssToClus;
  }
  </code></pre>
  
  <p>This is the function in which the code exist</p>