public static List<Pair<BrainRegion, BrainRegion>> combinaisonPairs2(
            Collection<BrainRegion> br) {

        List<Pair<BrainRegion, BrainRegion>> pairs = newArrayList();
        // we need at least 2 elems to find pairs
        if (br == null || br.size() < 2)
            return pairs;

        // Create the initial vector
        ICombinatoricsVector<BrainRegion> initialVector = Factory
                .createVector(br);

        // Create a simple combination generator to generate 2-combinations of
        // the initial vector
        Generator<BrainRegion> gen = Factory.createSimpleCombinationGenerator(
                initialVector, 2);

        // get all possible combinations
        for (ICombinatoricsVector<BrainRegion> combination : gen) {
            BrainRegion br1 = combination.getValue(0);
            BrainRegion br2 = combination.getValue(1);

            // filter if same text
            if (br1.getCoveredText().equals(br2.getCoveredText()))
                continue;

            pairs.add(new Pair<BrainRegion, BrainRegion>(br1, br2));
        }

        return pairs;
    }
public static List < Pair < BrainRegion , BrainRegion > > combinaisonPairs2 ( Collection < BrainRegion > br ) { List < Pair < BrainRegion , BrainRegion > > pairs = newArrayList ( ) ; if ( br == null || br . size ( ) < 2 ) return pairs ; ICombinatoricsVector < BrainRegion > initialVector = Factory . createVector ( br ) ; Generator < BrainRegion > gen = Factory . createSimpleCombinationGenerator ( initialVector , 2 ) ; for ( ICombinatoricsVector < BrainRegion > combination : gen ) { BrainRegion br1 = combination . getValue ( 0 ) ; BrainRegion br2 = combination . getValue ( 1 ) ; if ( br1 . getCoveredText ( ) . equals ( br2 . getCoveredText ( ) ) ) continue ; pairs . add ( new Pair < BrainRegion , BrainRegion > ( br1 , br2 ) ) ; } return pairs ; }
@return all simple 2-combinaisons