title: Find the number in list which is not present in Database column
body: <p>I have one requirement where I need to find the first missing number in the ArrayList which is not there in Database(Oracle) column.</p>
  
  <p>Scenario is like this :</p>
  
  <p>Table 1:</p>
  
  <p><a href="https://i.stack.imgur.com/iXm6N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iXm6N.png" alt="enter image description here"></a></p>
  
  <p>From the above table I am thinking to make 3 lists</p>
  
  <pre><code>List&lt;Integer&gt; lst1 = new ArrayList&lt;Integer&gt;();
  List&lt;Integer&gt; lst2 = new ArrayList&lt;Integer&gt;();
  List&lt;Integer&gt; lst3 = new ArrayList&lt;Integer&gt;();
  </code></pre>
  
  <p>lst1 -> [0,1,2,3,4,5,6....1000]</p>
  
  <p>lst2 -> [a0,a1,a2,a3,a4,a5,a6....a1000]</p>
  
  <p>lst3 -> [b0,b1,b2,b3,b4,b5,b6....b1000]</p>
  
  <p>As of now the lists contains approx 1000 values in the serial order.</p>
  
  <p>Now I have a Database table as below  </p>
  
  <p><a href="https://i.stack.imgur.com/OvAmW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OvAmW.png" alt="enter image description here"></a></p>
  
  <p>How can I match the lsts with Range column.
  I need to find what value from lsts is not present in this table ?</p>
  
  <p>Like in this case, if we see from the "lst1" the first available value which is not there in the table is "1" then next available value is "3" and then 5.6...so on.
  Similarly for "lst2" the first missing value is "a3"</p>
  
  <p>Is there any way to do ?</p>