code: public String getLastRelease(final Collection<String> versions) {
          final List<Version> sorted = versions.stream()
                  .filter(Version::isValid)               // filter invalid input values
                  .map(Version::make)
                  .filter(Optional::isPresent)
                  .map(Optional::get)
                  .filter(Version::isRelease)
                  .sorted((v1, v2) -> {
                      try {
                          return v1.compare(v2);
                      } catch (IncomparableException e) {
                          return 0;
                      }
                  })
                  .collect(Collectors.toList());
  
          if(sorted.isEmpty()) {
              if(LOG.isWarnEnabled()) {
                  LOG.warn(String.format("Cannot obtain last release from collection %s", versions.toString()));
              }
              return null;
          }
  
          return sorted.get(sorted.size() - 1).toString();
      }
docs: Find-out the last release version in a list of version (regarding Axway Conventions)
  
  @param versions
  @return String
  @throws IncomparableException