All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.molecules.leet.chem.CombinatoricsUtils Maven / Gradle / Ivy

There is a newer version: 0.0.5
Show newest version
package tech.molecules.leet.chem;

import java.util.ArrayList;
import java.util.List;

public class CombinatoricsUtils {


    public static List intSeq(int end) {
        return intSeq(0,end,new ArrayList<>());
    }

    public static List intSeq(int end, List skip) {
        return intSeq(0,end,skip);
    }

    public static List intSeq(int start, int end, List skip) {
        List seq = new ArrayList<>();
        for(int zi=start;zi> all_permutations(List li) {
        if(li.size()==1) {
            ArrayList> pi = new ArrayList<>();
            pi.add( new ArrayList<>(li) );
            return pi;
        }
        List> all_permutations = new ArrayList<>();
        for(int zi=0;zi li2 = new ArrayList<>(li);
            Integer xi = li2.get(zi);
            li2.remove(zi);
            List> perms = all_permutations(li2);
            for(List pei : perms) {
                pei.add(xi);
                all_permutations.add(pei);
            }
        }
        return all_permutations;
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy