code: public static Set<String> getAlgorithms(String serviceName) {
  
          if ((serviceName == null) || (serviceName.length() == 0) ||
              (serviceName.endsWith("."))) {
              return Collections.EMPTY_SET;
          }
  
          HashSet<String> result = new HashSet<>();
          Provider[] providers = Security.getProviders();
  
          for (int i = 0; i < providers.length; i++) {
              // Check the keys for each provider.
              for (Enumeration<Object> e = providers[i].keys();
                                                  e.hasMoreElements(); ) {
                  String currentKey = ((String)e.nextElement()).toUpperCase();
                  if (currentKey.startsWith(serviceName.toUpperCase())) {
                      // We should skip the currentKey if it contains a
                      // whitespace. The reason is: such an entry in the
                      // provider property contains attributes for the
                      // implementation of an algorithm. We are only interested
                      // in entries which lead to the implementation
                      // classes.
                      if (currentKey.indexOf(" ") < 0) {
                          result.add(currentKey.substring(serviceName.length() + 1));
                      }
                  }
              }
          }
          return Collections.unmodifiableSet(result);
      }
docs: Returns a Set of Strings containing the names of all available
  algorithms or types for the specified Java cryptographic service
  (e.g., Signature, MessageDigest, Cipher, Mac, KeyStore). Returns
  an empty Set if there is no provider that supports the
  specified service or if serviceName is null. For a complete list
  of Java cryptographic services, please see the
  <a href="{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/crypto/CryptoSpec.html">Java
  Cryptography Architecture API Specification &amp; Reference</a>.
  Note: the returned set is immutable.
  
  @param serviceName the name of the Java cryptographic
  service (e.g., Signature, MessageDigest, Cipher, Mac, KeyStore).
  Note: this parameter is case-insensitive.
  
  @return a Set of Strings containing the names of all available
  algorithms or types for the specified Java cryptographic service
  or an empty set if no provider supports the specified service.
  
  @since 1.4