package com.chaoticdawgsoftware.algorithms.providerutils;

import java.security.Provider;
import java.security.Security;
import java.util.*;

/**
 * ProviderAlgorithmRetrievingFactory.java
 * Created by ChaoticDawg on 1/20/17.
 */

public class ProviderAlgorithmRetrievingFactory {
    private static Provider[] providers = Security.getProviders();

    public static ArrayList<String> getAlgorithmList(String algorithm) {
        return getSortedAlgorithmList(buildAlgorithmList(algorithm));
    }

    private static ArrayList<String> buildAlgorithmList(String algorithm) {
        Set<String> keyNameSet = new HashSet<>();
        for (Provider provider : providers)
            ProviderKeyListCreator.getKeyList(algorithm, keyNameSet, provider);

        return new ArrayList<>(keyNameSet);
    }

    private static ArrayList<String> getSortedAlgorithmList(ArrayList<String> keyList) {
        Collections.sort(keyList);
        return keyList;
    }
}

@@ -428,24 +428,26 @@
     
-return getSorted
+ArrayList%3CString%3E 
 Algo
@@ -455,17 +455,19 @@
 ithmList
-(
+ = 
 buildAlg
@@ -487,17 +487,87 @@
 gorithm)
-)
+;%0A        Collections.sort(AlgorithmList);%0A        return AlgorithmList
 ;%0A    %7D%0A
@@ -871,162 +871,7 @@
    %7D
-%0A%0A    private static ArrayList%3CString%3E getSortedAlgorithmList(ArrayList%3CString%3E keyList) %7B%0A        Collections.sort(keyList);%0A        return keyList;%0A    %7D
 %0A%7D%0A

Remove getSortedAlgorithmList method add sort to getAlgorithmList