heap pollution my ass

fukurou

the supreme coder
ADMIN
Java:
    public void generatePermutations(ArrayList<String>... lists){
        ArrayList<ArrayList<String>> ll = new ArrayList<>();
        Collections.addAll(ll, lists);
        result = new ArrayList<>();
        generatePermutations(ll, this.result, 0, "");
    }

@the living tribunal
 

fukurou

the supreme coder
ADMIN
the compiler is scared some lamer would use an arraylist of ints,
because varargs can't enforce generic types.

here is the fix:

Java:
    @SafeVarargs
    public final void generatePermutations(ArrayList<String>... lists){
        ArrayList<ArrayList<String>> ll = new ArrayList<>();
        Collections.addAll(ll, lists);
        result = new ArrayList<>();
        generatePermutations(ll, this.result, 0, "");
    }
 
Top