title: How to present the nullable primitive type int in Java?
body: <p>I am designing an entity class which has a field named "documentYear", which might have unsigned integer values such as 1999, 2006, etc. Meanwhile, this field might also be "unknown", that is, not sure which year the document is created.</p>
  
  <p>Therefore, a nullable <strong>int</strong> type as in C# will be well suited. However, Java does not have a nullable feature as C# has. </p>
  
  <p>I have two options but I don't like them both:</p>
  
  <ol>
  <li>Use <code>java.lang.Integer</code> instead of the primitive type <code>int</code>;</li>
  <li>Use -1 to present the "unknown" value</li>
  </ol>
  
  <p>Does anyone have better options or ideas? </p>
  
  <p><strong>Update</strong>: My entity class will have tens of thousands of instances; therefore the overhead of java.lang.Integer might be too heavy for overall performance of the system.</p>