title: How to change Optional field(Java 8 API) into Java 7
body: <p>I have an application taken from Github in which Java 8 API, namely Optional keyword, is used. But the environment which I would like to run this app is setup to JDK_7. Hence, as I have zero experience with Java 8 API, Can anybody give an alternative code block of the following sample code:</p>
  
  <pre><code>public final static Optional&lt;String&gt; reverseGeocodeFromLatLong(final double latitude, final double longitude) {
      final StringBuilder bingMapsURL = new StringBuilder();
      bingMapsURL
              .append(BING_MAPS_URL_START)
              .append(latitude)
              .append(",")
              .append(longitude)
              .append(BING_MAPS_URL_MIDDLE_JSON)
              .append(Constants.BING_MAPS_API_KEY_VALUE);
      LOGGER.debug("BingMapsURL==&gt;{}", bingMapsURL.toString());
  
      HttpURLConnection httpURLConnection;
      InputStream inputStream = null;
      try {
          final URL url = new URL(bingMapsURL.toString());
          httpURLConnection = (HttpURLConnection)url.openConnection();
  
          if(HttpURLConnection.HTTP_OK == httpURLConnection.getResponseCode()){
              inputStream = httpURLConnection.getInputStream();
              return getStateFromJSONResponse(inputStream);
          }
      } catch (final Throwable throwable) {
          LOGGER.error(throwable.getMessage(), throwable);
          throwable.printStackTrace();
      } finally{
          if(null != inputStream) {
              try {
                  inputStream.close();
              } catch (final IOException ioException) {
                  LOGGER.error(ioException.getMessage(), ioException);
                  ioException.printStackTrace();
              }
          }
          httpURLConnection = null;
      }
      return Optional.absent();
  }
  </code></pre>