Skip to content

Instantly share code, notes, and snippets.

@blackdev1l
Created March 30, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blackdev1l/d3a23090d5b62590a6fdb87d166ea94d to your computer and use it in GitHub Desktop.
Save blackdev1l/d3a23090d5b62590a6fdb87d166ea94d to your computer and use it in GitHub Desktop.
Optional<File[]> files = Optional.ofNullable(new File(staticFolder).listFiles());
return files.map(logos -> Arrays.stream(logos)
.filter(file -> file.getName().matches(".+(png|jpg|gif)"))
.findFirst()
.map(filename -> String.format("%s/%s/logo/%s", staticUrl, division, filename))
.orElse(""))
.orElse("");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment