<commit_before>import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

class Matrix {

    private int[][] matrix = null;
    private int[][] transposedMatrix = null;
    private int numberOfRows;
    private int numberOfColumns;

    Matrix(List<List<Integer>> values) {
        if (!values.isEmpty()) {
            this.numberOfRows = values.size();
            this.numberOfColumns = values.get(0).size();
            matrix = new int[numberOfRows][numberOfColumns];
            transposedMatrix = new int[numberOfColumns][numberOfRows];
            for (int i = 0; i < numberOfRows; i++) {
                for (int j = 0; j < numberOfColumns; j++) {
                    matrix[i][j] = values.get(i).get(j);
                    transposedMatrix[j][i] = values.get(i).get(j);
                }
            }
        }
    }

    Set<MatrixCoordinate> getSaddlePoints() {
        if (matrix == null) {
            return Set.of();
        }
        Set<MatrixCoordinate> saddlePoints = new HashSet<>();
        List<Integer> rowMaxList = Arrays.stream(this.matrix).map(array -> Arrays.stream(array).max().getAsInt()).collect(Collectors.toList());
        List<Integer> rowMinList = Arrays.stream(this.transposedMatrix).map(array -> Arrays.stream(array).min().getAsInt()).collect(Collectors.toList());
        for (int i = 0; i < numberOfRows; i++) {
            for (int j = 0; j < numberOfColumns; j++) {
                if (rowMaxList.get(i) == rowMinList.get(j)) {
                    saddlePoints.add(new MatrixCoordinate(i + 1, j + 1));
                }
            }
        }
        return saddlePoints;
    }
}
<commit_msg>Nouvelle version légèrement refactorisée de Saddle Points<commit_after>import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

class Matrix {

    private int[][] matrix = null;
    private int[][] transposedMatrix = null;
    private int numberOfRows;
    private int numberOfColumns;
    private Set<MatrixCoordinate> saddlePoints;

    Matrix(List<List<Integer>> values) {
        if (!values.isEmpty()) {
            this.numberOfRows = values.size();
            this.numberOfColumns = values.get(0).size();
            matrix = new int[numberOfRows][numberOfColumns];
            transposedMatrix = new int[numberOfColumns][numberOfRows];
            for (int i = 0; i < numberOfRows; i++) {
                for (int j = 0; j < numberOfColumns; j++) {
                    matrix[i][j] = values.get(i).get(j);
                    transposedMatrix[j][i] = values.get(i).get(j);
                }
            }
        }
        precomputeSaddlePoints();
    }

    private void precomputeSaddlePoints() {
        if (matrix == null) {
            this.saddlePoints = Set.of();
        } else {
            Set<MatrixCoordinate> saddlePoints = new HashSet<>();
            List<Integer> rowMaxList = Arrays.stream(this.matrix).map(array -> Arrays.stream(array).max().getAsInt()).collect(Collectors.toList());
            List<Integer> rowMinList = Arrays.stream(this.transposedMatrix).map(array -> Arrays.stream(array).min().getAsInt()).collect(Collectors.toList());
            for (int i = 0; i < numberOfRows; i++) {
                for (int j = 0; j < numberOfColumns; j++) {
                    if (rowMaxList.get(i) == rowMinList.get(j)) {
                        saddlePoints.add(new MatrixCoordinate(i + 1, j + 1));
                    }
                }
            }
            this.saddlePoints = saddlePoints;
        }
    }

    Set<MatrixCoordinate> getSaddlePoints() {
        return this.saddlePoints;
    }
}

{'fraction_non_alphanumeric': 0.13602150537634408, 'fraction_numerical': 0.003763440860215054, 'mean_word_length': 2.1507197290431836, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '672234', 'n_tokens_mistral': 1110, 'n_tokens_neox': 1079, 'n_words': 218}