title: Best practice for returning multiple values in Java?
body: <p>Today I've added a extra security check behind my login forms, to slow down brute force attacks. I've got multiple login forms and made a nice easy to call function that does all the checking and then returns the result.</p>
  
  <pre><code>public static ValidateLoginResult validateLogin(HttpServletRequest request, String email, String password) {
  </code></pre>
  
  <p>The problem is the result is not a single value, the result consists of:</p>
  
  <pre><code>boolean ok
  String errorMessage
  boolean displayCaptcha
  </code></pre>
  
  <p>For this I created a new class. This all works fine.</p>
  
  <p>But I often have handy utility functions that return multiple values and start to find it a bit annoying to create a new class for the result every time.</p>
  
  <p>Is there a better way of returning multiple values? Or am I just lazy? :)</p>