code: private static String buildRegexString(Collection<String> extensions) {
          StringBuilder sb = new StringBuilder();
          Iterator<String> iterator = extensions.iterator();
          while (iterator.hasNext()) {
              String extension = iterator.next();
              sb.append(FILE_EXTENSION_PREFIX_REGEX);
              sb.append(extension);
              if (iterator.hasNext()) {
                  sb.append(OR_REGEX);
              }
          }
          return sb.toString();
      }
docs: /* --- Private methods ---