title: Optional <Integer> cannot be converted to Int (for use on GUI Progress Bar)
body: <p>I am receiving below error, when I try to set value on a JProgressBar.</p>
  
  <blockquote>
    <p>"Optional  cannot be converted to Int"</p>
  </blockquote>
  
  <p>Could someone please advise any workarounds/Solution??</p>
  
  <pre><code>public GUI(){
      initComponents();
      tL = new TasksToDo();
      jProgressBar1.setValue(tL.retrieveTotalHours());// [Where my error occurs]}
  }  
  </code></pre>
  
  <p>And from the TaskToDo Class, Originally I set this to ArrayList but the warnings said needed to switch to Optional:</p>
  
  <pre><code>  public class TasksToDo {
  
      public static ArrayList&lt;Task&gt; taskList;
  
      public TasksToDo(){
          taskList = new ArrayList&lt;Task&gt;();
          taskList.add(new Task(0,"Whitepaper", "Write first draft of Whitepaper",  7));
          taskList.add(new Task(1,"Create Database Structure", "Plan required fields and tables",  1));
          taskList.add(new Task(2,"Setup ODBC Connections", "Create the ODBC Connections between SVR1 to DEV-SVR",  2));
  
      }
  
      public void addTask (int taskId, String taskTitle, String taskDescription,  int taskHours){}
  
      public ArrayList&lt;Task&gt; retrieveTask(){
          return taskList;
      }
  
      public Optional&lt;Integer&gt; retrieveTotalHours(){
      return taskList.stream().map(e -&gt; e.getTaskHours()).reduce(Integer::sum);
      }
  }
  </code></pre>