	public static void main(String[] args) throws Exception {
		Config config = ConfigUtils.createConfig();
		config.network().setInputFile(args[0]);
		Scenario scenario = ScenarioUtils.loadScenario(config);
		Network network = scenario.getNetwork();

		for (Link l : network.getLinks().values()) {
			Set<String> modes = new HashSet<>();
			modes.addAll(l.getAllowedModes());
			if (modes.contains(searchMode)) {
				modes.add(addedMode);
				l.setAllowedModes(modes);
			}
		}

		new NetworkWriter(network).write(args[0]);
		System.out.println("done.");
	}

	public static void main(String[] args) throws Exception {
		Config config = ConfigUtils.createConfig();
		config.network().setInputFile(args[0]);
		Scenario scenario = ScenarioUtils.loadScenario(config);
		Network network = scenario.getNetwork();

		for (Link l : network.getLinks().values()) {
			Set<String> modes = new HashSet<String>();
			modes.addAll(l.getAllowedModes());
			if (modes.contains(searchMode)) {
				modes.add(addedMode);
				l.setAllowedModes(modes);
			}
		}

		new NetworkWriter(network).write(args[0]);
		System.out.println("done.");
	}

Replace Generic With Diamond HashSet<String> with HashSet<> in method public main(args String[]) : void from class net.bhl.matsim.uam.scenario.network.RunAddModeToNetwork


    private UAMRoutes() {
    	routes = new HashMap<>();
    }

    private UAMRoutes() {
    	routes = new HashMap<String, UAMRoute>();
    }

Replace Generic With Diamond HashMap<String,UAMRoute> with HashMap<> in method private UAMRoutes() from class net.bhl.matsim.uam.data.UAMRoutes


    public static void replaceLine(String filePath) {
        try (BufferedReader reader = new BufferedReader(new FileReader(filePath));
             BufferedWriter writer = new BufferedWriter(new FileWriter(filePath))) {
            StringBuilder content = new StringBuilder();
            String line;

            int lineNumber = 1;
            while ((line = reader.readLine()) != null) {
                if (lineNumber == 13) {
                    content.append("@attribute Buggy {Yes,No}").append(System.lineSeparator());
                } else {
                    content.append(line).append(System.lineSeparator());
                }
                lineNumber++;
            }

            writer.write(content.toString());
            out.println("Linea sostituita correttamente.");

        } catch (IOException e) {
            out.println("Si è verificato un errore durante la sostituzione della linea: " + e.getMessage());
        }
    }

    public static void replaceLine(String filePath) {
        try {
            BufferedReader reader = new BufferedReader(new FileReader(filePath));
            StringBuilder content = new StringBuilder();
            String line;

            int lineNumber = 1;
            while ((line = reader.readLine()) != null) {
                if (lineNumber == 13) {
                    content.append("@attribute Buggy {Yes,No}").append(System.lineSeparator());
                } else {
                    content.append(line).append(System.lineSeparator());
                }
                lineNumber++;
            }

            reader.close();

            BufferedWriter writer = new BufferedWriter(new FileWriter(filePath));
            writer.write(content.toString());
            writer.close();

            System.out.println("Linea sostituita correttamente.");

        } catch (IOException e) {
            System.out.println("Si è verificato un errore durante la sostituzione della linea: " + e.getMessage());
        }
    }

Try With Resources try(BufferedReader reader=new BufferedReader(new FileReader(filePath)); BufferedWriter writer=new BufferedWriter(new FileWriter(filePath))) in method public replaceLine(filePath String) : void from class defectprediction.Utils


    private void printCsvWalkForward(String projName) throws IOException {
        //crea due csv per ogni release del progetto (a partire dalla seconda release), uno conterrà il set di dati per il training, l'altro per il setting, secondo un approccio walkForward
        for (int i = 1; i < releases.size(); i++) { //l'indice i tiene traccia della creazione di training e testing set usati nell'i-esima iterazione del walkForward
            String trainingName = projName + "training_" + i + ".csv";
            String testingName = projName + "testing_" + i + ".csv";
            try (FileWriter trainingWriter = new FileWriter(trainingName);
                 FileWriter testingWriter = new FileWriter(testingName)) {
                //Name of CSV for output
                trainingWriter.append("LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
                trainingWriter.append("\n");
                for (int j = 0; j < i; j++) {
                        for (Class javaClass : releases.get(j).getAllClasses().values()) {
                            trainingWriter.append(String.valueOf(javaClass.getSize()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getLocTouched()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getNr()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getnFix()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getnAuth()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getLocAdded()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getChurn()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getMaxChurn()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getAverageChurn()));
                            trainingWriter.append(",");
                            if (javaClass.isBuggy()) trainingWriter.append("Yes");
                            else trainingWriter.append("No");
                            trainingWriter.append("\n");
                        }
                }

                testingWriter.append("LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
                testingWriter.append("\n");
                for (Class javaClass : releases.get(i).getAllClasses().values()) {
                    testingWriter.append(String.valueOf(javaClass.getSize()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getLocTouched()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getNr()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getnFix()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getnAuth()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getLocAdded()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getChurn()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getMaxChurn()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getAverageChurn()));
                    testingWriter.append(",");
                    if (javaClass.isBuggy()) testingWriter.append("Yes");
                    else testingWriter.append("No");
                    testingWriter.append("\n");
                }
            }
        }
    }

    private void printCsvWalkForward(String projName) throws IOException {
        FileWriter trainingWriter = null;
        FileWriter testingWriter = null;
        //crea due csv per ogni release del progetto (a partire dalla seconda release), uno conterrà il set di dati per il training, l'altro per il setting, secondo un approccio walkForward
        for (int i = 1; i < releases.size(); i++) { //l'indice i tiene traccia della creazione di training e testing set usati nell'i-esima iterazione del walkForward
            try {
                String trainingName = projName + "training_" + i + ".csv";
                //Name of CSV for output
                trainingWriter = new FileWriter(trainingName);
                trainingWriter.append("LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
                trainingWriter.append("\n");
                for (int j = 0; j < i; j++) {
                        for (Class javaClass : releases.get(j).getAllClasses().values()) {
                            trainingWriter.append(String.valueOf(javaClass.getSize()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getLocTouched()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getNr()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getnFix()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getnAuth()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getLocAdded()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getChurn()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getMaxChurn()));
                            trainingWriter.append(",");
                            trainingWriter.append(String.valueOf(javaClass.getAverageChurn()));
                            trainingWriter.append(",");
                            if (javaClass.isBuggy()) trainingWriter.append("Yes");
                            else trainingWriter.append("No");
                            trainingWriter.append("\n");
                        }
                }

                String testingName = projName + "testing_" + i + ".csv";
                testingWriter = new FileWriter(testingName);
                testingWriter.append("LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
                testingWriter.append("\n");
                for (Class javaClass : releases.get(i).getAllClasses().values()) {
                    testingWriter.append(String.valueOf(javaClass.getSize()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getLocTouched()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getNr()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getnFix()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getnAuth()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getLocAdded()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getChurn()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getMaxChurn()));
                    testingWriter.append(",");
                    testingWriter.append(String.valueOf(javaClass.getAverageChurn()));
                    testingWriter.append(",");
                    if (javaClass.isBuggy()) testingWriter.append("Yes");
                    else testingWriter.append("No");
                    testingWriter.append("\n");
                }
            } finally {
                trainingWriter.close();
                testingWriter.close();
            }
        }
    }

Try With Resources try(FileWriter trainingWriter=new FileWriter(trainingName); FileWriter testingWriter=new FileWriter(testingName)) in method private printCsvWalkForward(projName String) : void from class defectprediction.control.GitController


    private void printDatasetToCsv(String projName) throws IOException {
        String outname = projName + "dataset.csv";
        try (FileWriter fileWriter = new FileWriter(outname)) {
            //Name of CSV for output
            fileWriter.append("Version,File Name,LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
            fileWriter.append("\n");
            for (Version release : releases) {
                if (release.getAllClasses() != null) {
                    for (Class javaClass : release.getAllClasses().values()) {
                        fileWriter.append(String.valueOf(javaClass.getVersion().getIndex()));
                        fileWriter.append(",");
                        fileWriter.append(javaClass.getPath());
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getSize()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getLocTouched()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getNr()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getnFix()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getnAuth()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getLocAdded()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getChurn()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getMaxChurn()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getAverageChurn()));
                        fileWriter.append(",");
                        if (javaClass.isBuggy()) fileWriter.append("Yes");
                        else fileWriter.append("No");
                        fileWriter.append("\n");
                    }
                }
            }
        }
    }

    private void printDatasetToCsv(String projName) throws IOException {
        FileWriter fileWriter = null;
        try {
            String outname = projName + "dataset.csv";
            //Name of CSV for output
            fileWriter = new FileWriter(outname);
            fileWriter.append("Version,File Name,LOC,LOC_touched,NR,NFix,NAuth,LOC_added,MAX_LOC_added,Churn,MAX_Churn,AVG_Churn,Buggy");
            fileWriter.append("\n");
            for (Version release : releases) {
                if (release.getAllClasses() != null) {
                    for (Class javaClass : release.getAllClasses().values()) {
                        fileWriter.append(String.valueOf(javaClass.getVersion().getIndex()));
                        fileWriter.append(",");
                        fileWriter.append(javaClass.getPath());
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getSize()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getLocTouched()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getNr()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getnFix()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getnAuth()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getLocAdded()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getMaxLocAdded()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getChurn()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getMaxChurn()));
                        fileWriter.append(",");
                        fileWriter.append(String.valueOf(javaClass.getAverageChurn()));
                        fileWriter.append(",");
                        if (javaClass.isBuggy()) fileWriter.append("Yes");
                        else fileWriter.append("No");
                        fileWriter.append("\n");
                    }
                }
            }
        } finally {
            fileWriter.close();
        }
    }

Try With Resources try(FileWriter fileWriter=new FileWriter(outname)) in method private printDatasetToCsv(projName String) : void from class defectprediction.control.GitController


    public void printEvaluationsToCsv(String projName) throws IOException {
        String outname = projName + "evaluations.csv";
        try (FileWriter fileWriter = new FileWriter(outname);) {
            //Name of CSV for output
            fileWriter.append("Dataset, #TrainingReleases, Classifier, TruePositiveRate, FalsePositiveRate, Precision, Recall, AUC, Kappa, FMeasure");
            fileWriter.append("\n");
            for (ClassifierEvaluation evaluation : evaluations) {
                fileWriter.append(evaluation.getProjName());
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getNumTrainingReleases()));
                fileWriter.append(",");
                fileWriter.append(evaluation.getClassifier());
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getTpRate()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getFpRate()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getPrecision()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getRecall()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getAuc()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getKappa()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getF1()));
                fileWriter.append("\n");
            }
        }
    }

    public void printEvaluationsToCsv(String projName) throws IOException {
        FileWriter fileWriter = null;
        try {
            String outname = projName + "evaluations.csv";
            //Name of CSV for output
            fileWriter = new FileWriter(outname);
            fileWriter.append("Dataset, #TrainingReleases, Classifier, TruePositiveRate, FalsePositiveRate, Precision, Recall, AUC, Kappa, FMeasure");
            fileWriter.append("\n");
            for (ClassifierEvaluation evaluation : evaluations) {
                fileWriter.append(evaluation.getProjName());
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getNumTrainingReleases()));
                fileWriter.append(",");
                fileWriter.append(evaluation.getClassifier());
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getTpRate()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getFpRate()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getPrecision()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getRecall()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getAuc()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getKappa()));
                fileWriter.append(",");
                fileWriter.append(String.valueOf(evaluation.getF1()));
                fileWriter.append("\n");
            }
        } finally {
            fileWriter.close();
        }
    }

Try With Resources try(FileWriter fileWriter=new FileWriter(outname)) in method public printEvaluationsToCsv(projName String) : void from class defectprediction.control.WekaController


    protected URI buildUri(String path, String parameterName, String parameterValue) {
        MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
        parameters.set(parameterName, parameterValue);
        return buildUri(path, parameters);
    }

    protected URI buildUri(String path, String parameterName, String parameterValue) {
        MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
        parameters.set(parameterName, parameterValue);
        return buildUri(path, parameters);
    }

Replace Generic With Diamond LinkedMultiValueMap<String,String> with LinkedMultiValueMap<> in method protected buildUri(path String, parameterName String, parameterValue String) : URI from class org.springframework.social.spotify.api.impl.AbstractSpotifyOperations


    @Override
    public CursoredSpotifyList<SpotifyPlaylist> getUserPlaylists(String userId, int limit,
            int offset) {
        requireUserAuthorization();
        MultiValueMap<String, String> parameters = new LinkedMultiValueMap<>();
        parameters.set("limit", String.valueOf(limit));
        parameters.set("offset", String.valueOf(offset));

        return restTemplate.getForObject(buildUri("users/" + userId + "/playlists", parameters),
                CursoredSpotifyPlaylist.class).getPlaylists();
    }

    @Override
    public CursoredSpotifyList<SpotifyPlaylist> getUserPlaylists(String userId, int limit,
            int offset) {
        requireUserAuthorization();
        MultiValueMap<String, String> parameters = new LinkedMultiValueMap<String, String>();
        parameters.set("limit", String.valueOf(limit));
        parameters.set("offset", String.valueOf(offset));

        return restTemplate.getForObject(buildUri("users/" + userId + "/playlists", parameters),
                CursoredSpotifyPlaylist.class).getPlaylists();
    }

Replace Generic With Diamond LinkedMultiValueMap<String,String> with LinkedMultiValueMap<> in method public getUserPlaylists(userId String, limit int, offset int) : CursoredSpotifyList<SpotifyPlaylist> from class org.springframework.social.spotify.api.impl.PlaylistTemplate


    private PreparedStatementCreator createPreparedStatement(InsertSqlEntity insertSqlEntity) {
        return connection -> {
            PreparedStatement statement = connection.prepareStatement(insertSqlEntity.getInsertSql(), Statement.RETURN_GENERATED_KEYS);
            Object o;
            List<?> valueList = WsListUtils.listToList(insertSqlEntity.getValueList(), SqlParameter::getValue);
            for (int i = 0; i < valueList.size(); i++) {
                o = valueList.get(i);
                if (o == null) {
                    statement.setNull(i + 1, Types.NULL);
                    continue;
                }
                if (o instanceof String) {
                    statement.setString(i + 1, WsStringUtils.anyToString(o));
                } else if (o instanceof Integer || WsFieldUtils.classCompare(int.class, o.getClass())) {
                    statement.setInt(i + 1, WsBeanUtils.objectToT(o, int.class));
                } else if (o instanceof Long || WsFieldUtils.classCompare(o.getClass(), long.class)) {
                    statement.setLong(i + 1, WsBeanUtils.objectToT(o, long.class));
                } else if (o instanceof Short || WsFieldUtils.classCompare(o.getClass(), short.class)) {
                    statement.setShort(i + 1, WsBeanUtils.objectToT(o, short.class));
                } else if (o instanceof Float || WsFieldUtils.classCompare(o.getClass(), Float.class)) {
                    statement.setFloat(i + 1, WsBeanUtils.objectToT(o, float.class));
                } else if (o instanceof Double || WsFieldUtils.classCompare(o.getClass(), double.class)) {
                    statement.setDouble(i + 1, WsBeanUtils.objectToT(o, double.class));
                } else if (o instanceof BigDecimal) {
                    statement.setBigDecimal(i + 1, WsBeanUtils.objectToT(o, BigDecimal.class));
                } else if (o instanceof Date) {
                    statement.setString(i + 1, WsBeanUtils.objectToT(o, String.class));
                } else if (o instanceof LocalDate || o instanceof LocalDateTime) {
                    statement.setString(i + 1, WsBeanUtils.objectToT(o, String.class));
                }else {
                    statement.setObject(i+1,o);
                    //throw new RuntimeException("不支持的数据类型:" + o.getClass());
                }
            }
            return statement;
        };
    }

    private PreparedStatementCreator createPreparedStatement(InsertSqlEntity insertSqlEntity) {
        return new PreparedStatementCreator() {
            @Override
            public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
                PreparedStatement statement = connection.prepareStatement(insertSqlEntity.getInsertSql(), Statement.RETURN_GENERATED_KEYS);
                Object o;
                List<?> valueList = WsListUtils.listToList(insertSqlEntity.getValueList(), SqlParameter::getValue);
                for (int i = 0; i < valueList.size(); i++) {
                    o = valueList.get(i);
                    if (o == null) {
                        statement.setNull(i + 1, Types.NULL);
                        continue;
                    }
                    if (o instanceof String) {
                        statement.setString(i + 1, WsStringUtils.anyToString(o));
                    } else if (o instanceof Integer || WsFieldUtils.classCompare(int.class, o.getClass())) {
                        statement.setInt(i + 1, WsBeanUtils.objectToT(o, int.class));
                    } else if (o instanceof Long || WsFieldUtils.classCompare(o.getClass(), long.class)) {
                        statement.setLong(i + 1, WsBeanUtils.objectToT(o, long.class));
                    } else if (o instanceof Short || WsFieldUtils.classCompare(o.getClass(), short.class)) {
                        statement.setShort(i + 1, WsBeanUtils.objectToT(o, short.class));
                    } else if (o instanceof Float || WsFieldUtils.classCompare(o.getClass(), Float.class)) {
                        statement.setFloat(i + 1, WsBeanUtils.objectToT(o, float.class));
                    } else if (o instanceof Double || WsFieldUtils.classCompare(o.getClass(), double.class)) {
                        statement.setDouble(i + 1, WsBeanUtils.objectToT(o, double.class));
                    } else if (o instanceof BigDecimal) {
                        statement.setBigDecimal(i + 1, WsBeanUtils.objectToT(o, BigDecimal.class));
                    } else if (o instanceof Date) {
                        statement.setString(i + 1, WsBeanUtils.objectToT(o, String.class));
                    } else if (o instanceof LocalDate || o instanceof LocalDateTime) {
                        statement.setString(i + 1, WsBeanUtils.objectToT(o, String.class));
                    }else {
                        statement.setObject(i+1,o);
                        //throw new RuntimeException("不支持的数据类型:" + o.getClass());
                    }
                }
                return statement;
            }
        };
    }

Replace Anonymous With Lambda cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils.createPreparedStatement.new PreparedStatementCreator with connection -> {PreparedStatement statement=connection.prepareStatement(insertSqlEntity.getInsertSql(),Statement.RETURN_GENERATED_KEYS); in method private createPreparedStatement(insertSqlEntity InsertSqlEntity) : PreparedStatementCreator from class cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils


    private <T> List<T> queryList(String sql, List<Object> parameterList, SQLModelUtils sqlModelUtils) {
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), rs -> {
            return sqlModelUtils.margeMap(new JdkResultSet(rs));
        });
    }

    private <T> List<T> queryList(String sql, List<Object> parameterList, SQLModelUtils sqlModelUtils) {
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<>() {
            @Override
            public List<T> extractData(ResultSet rs) throws DataAccessException {
                return sqlModelUtils.margeMap(new JdkResultSet(rs));
            }
        });
    }

Replace Anonymous With Lambda cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils.queryList.query.new ResultSetExtractor<> with rs -> {return sqlModelUtils.margeMap(new JdkResultSet(rs)); in method private queryList(sql String, parameterList List<Object>, sqlModelUtils SQLModelUtils) : List<T> from class cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils


    private <T> T querySingleColumnObject(String sql,List<Object> parameterList,Class<T> returnType){
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), rs -> {
            if (rs.next()) {
                return WsBeanUtils.objectToT(rs.getObject(1), returnType);
            }
            return null;
        });
    }

    private <T> T querySingleColumnObject(String sql,List<Object> parameterList,Class<T> returnType){
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<>() {
            @Override
            public T extractData(ResultSet rs) throws SQLException, DataAccessException {
                if (rs.next()) {
                    return WsBeanUtils.objectToT(rs.getObject(1), returnType);
                }
                return null;
            }
        });
    }

Replace Anonymous With Lambda cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils.querySingleColumnObject.query.new ResultSetExtractor<> with rs -> {if(rs.next()){return WsBeanUtils.objectToT(rs.getObject(1),returnType); in method private querySingleColumnObject(sql String, parameterList List<Object>, returnType Class<T>) : T from class cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils


    private <T> List<T> queryList(String sql, List<Object> parameterList, SQLModelUtils sqlModelUtils) {
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<>() {
            @Override
            public List<T> extractData(ResultSet rs) throws DataAccessException {
                return sqlModelUtils.margeMap(new JdkResultSet(rs));
            }
        });
    }

    private <T> List<T> queryList(String sql, List<Object> parameterList, SQLModelUtils sqlModelUtils) {
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<List<T>>() {
            @Override
            public List<T> extractData(ResultSet rs) throws DataAccessException {
                return sqlModelUtils.margeMap(new JdkResultSet(rs));
            }
        });
    }

Replace Generic With Diamond ResultSetExtractor<List<T>> with ResultSetExtractor<> in method private queryList(sql String, parameterList List<Object>, sqlModelUtils SQLModelUtils) : List<T> from class cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils


    private <T> T querySingleColumnObject(String sql,List<Object> parameterList,Class<T> returnType){
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<>() {
            @Override
            public T extractData(ResultSet rs) throws SQLException, DataAccessException {
                if (rs.next()) {
                    return WsBeanUtils.objectToT(rs.getObject(1), returnType);
                }
                return null;
            }
        });
    }

    private <T> T querySingleColumnObject(String sql,List<Object> parameterList,Class<T> returnType){
        return jdbcTemplate.query(sql, new ArgumentPreparedStatementSetter(parameterList.toArray()), new ResultSetExtractor<T>() {
            @Override
            public T extractData(ResultSet rs) throws SQLException, DataAccessException {
                if(rs.next()){
                    return WsBeanUtils.objectToT(rs.getObject(1),returnType);
                }
                return null;
            }
        });
    }

Replace Generic With Diamond ResultSetExtractor<T> with ResultSetExtractor<> in method private querySingleColumnObject(sql String, parameterList List<Object>, returnType Class<T>) : T from class cn.katoumegumi.java.starter.jdbc.datasource.WsJdbcUtils


    public static <T> ExcelGenerator<T> create(List<T> tList) {
        ExcelGenerator<T> excelGenerator = new ExcelGenerator<>();
        excelGenerator.setValueList(tList);
        return excelGenerator;
    }

    public static <T> ExcelGenerator<T> create(List<T> tList) {
        ExcelGenerator<T> excelGenerator = new ExcelGenerator<T>();
        excelGenerator.setValueList(tList);
        return excelGenerator;
    }

Replace Generic With Diamond ExcelGenerator<T> with ExcelGenerator<> in method public create(tList List<T>) : ExcelGenerator<T> from class cn.katoumegumi.java.excel.ExcelGenerator


    public static String clientStart(HttpRequestBody httpRequestBody, final String id) {
        atomicInteger1.getAndAdd(1);
        //final String id = UUID.randomUUID().toString();
        //WsChannelHttpRequestBodyBind.createCountDownLatch(id);
        // long startTime = System.currentTimeMillis();

        WsChannelHttpRequestBodyBind.channelAndHttpRequestBodyBind(id, httpRequestBody);
        try {
            WsChannelHttpRequestBodyBind.semaphore.acquire();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        executor.execute(() -> {
            try {

                Channel channel = WsChannelHttpRequestBodyBind.getChannelString(httpRequestBody.getUri().getHost() + ":" + httpRequestBody.getPort());
                long endTime = System.currentTimeMillis();
                //log.info("执行clientStart所花费的时间为：{}", endTime - startTime);
                if (channel != null && channel.isActive()) {
                    //log.info("使用已缓存的channel{}",httpRequestBody.getUrl());
                    NettyHttpClientResponseHandler nettyHttpClientResponseHandler = (NettyHttpClientResponseHandler) channel.pipeline().get("http-server");
                    nettyHttpClientResponseHandler.setId(id);
                    nettyHttpClientResponseHandler.setHttpRequestBody(httpRequestBody);
                    WsNettyClientUtils.sendHttpRequest(channel, httpRequestBody, id);
                } else {
                    //log.info("使用了新连接");

                    Bootstrap bootstrap = new Bootstrap();
                    bootstrap.group(workEventExecutors);
                    bootstrap.channel(NioSocketChannel.class);
                    bootstrap.option(ChannelOption.SO_KEEPALIVE, true);
                    bootstrap.handler(new LoggingHandler(LogLevel.DEBUG));
                    ChannelFuture channelFuture;
                    bootstrap.handler(new HttpInitializer(httpRequestBody, id));
                    channelFuture = bootstrap.connect(httpRequestBody.getUri().getHost(), httpRequestBody.getPort());
                    channelFuture.channel().closeFuture().sync().addListener(new GenericFutureListener<>() {
                        @Override
                        public void operationComplete(Future<? super Void> future) throws Exception {
                            if (future.isSuccess()) {
                                log.info("关闭成功");
                            }
                        }
                    });
                    atomicInteger.getAndAdd(1);
                    log.info("{}结束{}", id, httpRequestBody.getUrl());
                }

            } catch (Exception e) {
                WsChannelHttpRequestBodyBind.semaphore.release();
                WsChannelHttpRequestBodyBind.countDownCountDownLatch(id);
                e.printStackTrace();
            }/*finally {
                workEventExecutors.shutdownGracefully();
            }*/
            long endTime = System.currentTimeMillis();

        });
        return id;
    }

    public static String clientStart(HttpRequestBody httpRequestBody, final String id) {
        atomicInteger1.getAndAdd(1);
        //final String id = UUID.randomUUID().toString();
        //WsChannelHttpRequestBodyBind.createCountDownLatch(id);
        // long startTime = System.currentTimeMillis();

        WsChannelHttpRequestBodyBind.channelAndHttpRequestBodyBind(id, httpRequestBody);
        try {
            WsChannelHttpRequestBodyBind.semaphore.acquire();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        executor.execute(() -> {
            try {

                Channel channel = WsChannelHttpRequestBodyBind.getChannelString(httpRequestBody.getUri().getHost() + ":" + httpRequestBody.getPort());
                long endTime = System.currentTimeMillis();
                //log.info("执行clientStart所花费的时间为：{}", endTime - startTime);
                if (channel != null && channel.isActive()) {
                    //log.info("使用已缓存的channel{}",httpRequestBody.getUrl());
                    NettyHttpClientResponseHandler nettyHttpClientResponseHandler = (NettyHttpClientResponseHandler) channel.pipeline().get("http-server");
                    nettyHttpClientResponseHandler.setId(id);
                    nettyHttpClientResponseHandler.setHttpRequestBody(httpRequestBody);
                    WsNettyClientUtils.sendHttpRequest(channel, httpRequestBody, id);
                } else {
                    //log.info("使用了新连接");

                    Bootstrap bootstrap = new Bootstrap();
                    bootstrap.group(workEventExecutors);
                    bootstrap.channel(NioSocketChannel.class);
                    bootstrap.option(ChannelOption.SO_KEEPALIVE, true);
                    bootstrap.handler(new LoggingHandler(LogLevel.DEBUG));
                    ChannelFuture channelFuture = null;
                    bootstrap.handler(new HttpInitializer(httpRequestBody, id));
                    channelFuture = bootstrap.connect(httpRequestBody.getUri().getHost(), httpRequestBody.getPort());
                    channelFuture.channel().closeFuture().sync().addListener(new GenericFutureListener<Future<? super Void>>() {
                        @Override
                        public void operationComplete(Future<? super Void> future) throws Exception {
                            if (future.isSuccess()) {
                                log.info("关闭成功");
                            }
                        }
                    });
                    atomicInteger.getAndAdd(1);
                    log.info("{}结束{}", id, httpRequestBody.getUrl());
                }

            } catch (Exception e) {
                WsChannelHttpRequestBodyBind.semaphore.release();
                WsChannelHttpRequestBodyBind.countDownCountDownLatch(id);
                e.printStackTrace();
            }/*finally {
                workEventExecutors.shutdownGracefully();
            }*/
            long endTime = System.currentTimeMillis();

        });
        return id;
    }

Replace Generic With Diamond GenericFutureListener<Future<? super Void>> with GenericFutureListener<> in method public clientStart(httpRequestBody HttpRequestBody, id String) : String from class cn.katoumegumi.java.http.client.WsNettyClient


    /**
     * Create an association between an anticipated response stream id and a {@link ChannelPromise}
     *
     * @param streamId    The stream for which a response is expected
     * @param writeFuture A future that represent the request write operation
     * @param promise     The promise object that will be used to wait/notify events
     * @return The previous object associated with {@code streamId}
     * @see HttpResponseHandler#awaitResponses(long, TimeUnit)
     */
    public Entry<ChannelFuture, ChannelPromise> put(int streamId, ChannelFuture writeFuture, ChannelPromise promise) {
        return streamidPromiseMap.put(streamId, new SimpleEntry<>(writeFuture, promise));
    }

    /**
     * Create an association between an anticipated response stream id and a {@link ChannelPromise}
     *
     * @param streamId    The stream for which a response is expected
     * @param writeFuture A future that represent the request write operation
     * @param promise     The promise object that will be used to wait/notify events
     * @return The previous object associated with {@code streamId}
     * @see HttpResponseHandler#awaitResponses(long, TimeUnit)
     */
    public Entry<ChannelFuture, ChannelPromise> put(int streamId, ChannelFuture writeFuture, ChannelPromise promise) {
        return streamidPromiseMap.put(streamId, new SimpleEntry<ChannelFuture, ChannelPromise>(writeFuture, promise));
    }

Replace Generic With Diamond SimpleEntry<ChannelFuture,ChannelPromise> with SimpleEntry<> in method public put(streamId int, writeFuture ChannelFuture, promise ChannelPromise) : Entry<ChannelFuture,ChannelPromise> from class cn.katoumegumi.java.http.client.handler.HttpResponseHandler


    public static void sendHttpRequest(ChannelHandlerContext ctx, HttpRequestBody httpRequestBody, String id) {
        WsChannelHttpRequestBodyBind.putChannelDelay(ctx.channel(), httpRequestBody, id);
        /*FullHttpRequest fullHttpRequest = createFullHttpRequest(httpRequestBody);
        ctx.write(fullHttpRequest);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.flush();*/
        HttpContent httpContent = createHttpContent(httpRequestBody);
        HttpRequest httpRequest = createHttpRequest(httpRequestBody, httpContent);
        ctx.write(httpRequest);
        ctx.write(httpContent);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT).addListener(new GenericFutureListener<>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        ctx.flush();
    }

    public static void sendHttpRequest(ChannelHandlerContext ctx, HttpRequestBody httpRequestBody, String id) {
        WsChannelHttpRequestBodyBind.putChannelDelay(ctx.channel(), httpRequestBody, id);
        /*FullHttpRequest fullHttpRequest = createFullHttpRequest(httpRequestBody);
        ctx.write(fullHttpRequest);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.flush();*/
        HttpContent httpContent = createHttpContent(httpRequestBody);
        HttpRequest httpRequest = createHttpRequest(httpRequestBody, httpContent);
        ctx.write(httpRequest);
        ctx.write(httpContent);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT).addListener(new GenericFutureListener<Future<? super Void>>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        ctx.flush();
    }

Replace Generic With Diamond GenericFutureListener<Future<? super Void>> with GenericFutureListener<> in method public sendHttpRequest(ctx ChannelHandlerContext, httpRequestBody HttpRequestBody, id String) : void from class cn.katoumegumi.java.http.client.utils.WsNettyClientUtils


    public static void sendHttpRequest(Channel ctx, HttpRequestBody httpRequestBody, String id) {
        WsChannelHttpRequestBodyBind.putChannelDelay(ctx, httpRequestBody, id);
        /*FullHttpRequest fullHttpRequest = createFullHttpRequest(httpRequestBody);
        ctx.write(fullHttpRequest);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.flush();*/
        HttpContent httpContent = createHttpContent(httpRequestBody);
        HttpRequest httpRequest = createHttpRequest(httpRequestBody, httpContent);
        ctx.write(httpRequest);
        ctx.write(httpContent).addListener(new GenericFutureListener<>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        //ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT).addListener(new GenericFutureListener<>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        ctx.flush();
    }

    public static void sendHttpRequest(Channel ctx, HttpRequestBody httpRequestBody, String id) {
        WsChannelHttpRequestBodyBind.putChannelDelay(ctx, httpRequestBody, id);
        /*FullHttpRequest fullHttpRequest = createFullHttpRequest(httpRequestBody);
        ctx.write(fullHttpRequest);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.flush();*/
        HttpContent httpContent = createHttpContent(httpRequestBody);
        HttpRequest httpRequest = createHttpRequest(httpRequestBody, httpContent);
        ctx.write(httpRequest);
        ctx.write(httpContent).addListener(new GenericFutureListener<Future<? super Void>>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        //ctx.write(LastHttpContent.EMPTY_LAST_CONTENT);
        ctx.write(LastHttpContent.EMPTY_LAST_CONTENT).addListener(new GenericFutureListener<Future<? super Void>>() {
            @Override
            public void operationComplete(Future<? super Void> future) throws Exception {
                if (future.isSuccess()) {
                }
            }
        });
        ctx.flush();
    }

Replace Generic With Diamond GenericFutureListener<Future<? super Void>> with GenericFutureListener<> in method public sendHttpRequest(ctx Channel, httpRequestBody HttpRequestBody, id String) : void from class cn.katoumegumi.java.http.client.utils.WsNettyClientUtils


    public static void main(String[] args) {
        while (true) {
            System.out.println("Please enter your digit");
            try (Scanner scanner = new Scanner(System.in)) {
                int digit = scanner.nextInt();
                System.out.println("Digit: " + digit);
                break;
            } catch (InputMismatchException exception) {
                System.out.println("It is not a digit");
            }
        }
        System.out.println("End");
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.println("Please enter your digit");
            try {
                int digit = scanner.nextInt();
                System.out.println("Digit: " + digit);
                break;
            } catch (InputMismatchException exception) {
                System.out.println("It is not a digit");
                scanner.nextLine();
            }
        }
        System.out.println("End");
        scanner.close();
    }

Try With Resources try(Scanner scanner=new Scanner(System.in)) in method public main(args String[]) : void from class lesson.lesson17.ET1


	protected IInfoflow initInfoflow() {
		Infoflow result = new Infoflow("", false, null);
		result.setSootConfig((options, config) -> {
			options.set_no_bodies_for_excluded(true);
			options.set_allow_phantom_refs(true);
			options.set_output_format(Options.output_format_none);
			options.setPhaseOption("jb", "use-original-names:true");
			options.set_ignore_classpath_errors(true);
			options.set_whole_program(true);
			options.set_verbose(true);
		});
		Map<String, Set<String>> taintedMethods = Collections.emptyMap();
		EasyTaintWrapper easyWrapper = new EasyTaintWrapper(taintedMethods);
		result.setTaintWrapper(easyWrapper);

		result.getConfig().setImplicitFlowMode(ImplicitFlowMode.AllImplicitFlows);
		return result;
	}

	protected IInfoflow initInfoflow(boolean useTaintWrapper) {
		Infoflow result = new Infoflow("", false, null);
		result.setSootConfig(new IInfoflowConfig() {

			@Override
			public void setSootOptions(Options options, InfoflowConfiguration config) {
				// explicitly include packages for shorter runtime:
				List<String> includeList = Arrays.asList("java.lang.*", "java.util.*", "java.io.*", "sun.misc.*",
						"java.net.*", "javax.servlet.*", "javax.crypto.*");
				Options.v().set_no_bodies_for_excluded(true);
				Options.v().set_allow_phantom_refs(true);
				options.set_include(includeList);
				options.set_output_format(Options.output_format_none);
				Options.v().setPhaseOption("jb", "use-original-names:true");
				Options.v().set_ignore_classpath_errors(true);
			}

		});
		Map<String, Set<String>> taintedMethods = Collections.emptyMap();
		EasyTaintWrapper easyWrapper = new EasyTaintWrapper(taintedMethods);
		result.setTaintWrapper(easyWrapper);

		result.getConfig().setImplicitFlowMode(ImplicitFlowMode.AllImplicitFlows);
		return result;
	}

Replace Anonymous With Lambda org.gravity.flowdroid.Example.initInfoflow.setSootConfig.new IInfoflowConfig with (options, config) -> {options.set_no_bodies_for_excluded(true); in method protected initInfoflow() : IInfoflow from class org.gravity.flowdroid.Example


	/**
	 * Creates a new tree showing the possible elements corresponding with a source
	 * element
	 *
	 * @param source      The source element
	 * @param mappingView The view holding all mappings
	 */
	private void initTree(EObject source, MappingView mappingView) {
		parent.setLayout(new GridLayout(1, false));
		treeViewer = new TreeViewer(parent, SWT.BORDER);
		MappingLabelProvider labelProvider = new MappingLabelProvider();
		treeViewer.setContentProvider(new DFDSelectionContentProvider(source));
		treeViewer.setLabelProvider(labelProvider);
		GridData layoutData = new GridData(GridData.FILL_BOTH);
		layoutData.widthHint = parent.getSize().x - 10;
		layoutData.heightHint = parent.getSize().y - 10;
		treeViewer.getControl().setLayoutData(layoutData);

		action = new UserdefinedAction(mappingView);

		treeViewer.addSelectionChangedListener((event) -> {
			ISelection selection = event.getSelection();
			if (selection instanceof IStructuredSelection) {
				action.setSelection((IStructuredSelection) selection);
				MenuManager menuMgr = new MenuManager();
				Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
				treeViewer.getControl().setMenu(menu);
				getSite().registerContextMenu(menuMgr, treeViewer);
				menuMgr.add(action);
			}
		});
		treeViewer.setInput(mappingView.getDFDs());
	}

	/**
	 * Creates a new tree showing the possible elements corresponding with a source
	 * element
	 *
	 * @param source      The source element
	 * @param mappingView The view holding all mappings
	 */
	private void initTree(EObject source, MappingView mappingView) {
		parent.setLayout(new GridLayout(1, false));
		treeViewer = new TreeViewer(parent, SWT.BORDER);
		MappingLabelProvider labelProvider = new MappingLabelProvider();
		treeViewer.setContentProvider(new DFDSelectionContentProvider(source));
		treeViewer.setLabelProvider(labelProvider);
		GridData layoutData = new GridData(GridData.FILL_BOTH);
		layoutData.widthHint = parent.getSize().x - 10;
		layoutData.heightHint = parent.getSize().y - 10;
		treeViewer.getControl().setLayoutData(layoutData);

		action = new UserdefinedAction(mappingView);

		treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

			public void selectionChanged(SelectionChangedEvent event) {
				ISelection selection = event.getSelection();
				if (selection instanceof IStructuredSelection) {
					action.setSelection((IStructuredSelection) selection);
					MenuManager menuMgr = new MenuManager();
					Menu menu = menuMgr.createContextMenu(treeViewer.getControl());
					treeViewer.getControl().setMenu(menu);
					getSite().registerContextMenu(menuMgr, treeViewer);
					menuMgr.add(action);
				}
			}
		});
		treeViewer.setInput(mappingView.getDFDs());
	}

Replace Anonymous With Lambda org.gravity.mapping.secdfd.views.DFDSelectionView.initTree.addSelectionChangedListener.new ISelectionChangedListener with (event) -> {ISelection selection=event.getSelection(); in method private initTree(source EObject, mappingView MappingView) : void from class org.gravity.mapping.secdfd.views.DFDSelectionView


	@Test
	public void test() throws NoSuchMethodException {
		soot.G.reset();

		IInfoflow infoflow = initInfoflow(false);
		String appPath = "examples/SecureDependencyExample/bin";
		String libPath = System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar";

		ArrayList<String> sources = new ArrayList<>();
		sources.add("<keygeneration.RandomGenerator: java.lang.Double random()>");

		ArrayList<String> sinks = new ArrayList<>();
		sinks.add(print(PrintStream.class.getDeclaredMethod("println", Object.class)));
		List<String> epoints = new ArrayList<>();

		epoints.add("<keygeneration.KeyGenerator: void main(java.lang.String[])>");
		infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
		infoflow.getResults();
	}

	@Test
	public void test() throws NoSuchMethodException {
		soot.G.reset();

		IInfoflow infoflow = initInfoflow(false);
		String appPath = "examples/SecureDependencyExample/bin";
		String libPath = System.getProperty("java.home") + File.separator + "lib" + File.separator + "rt.jar";

		ArrayList<String> sources = new ArrayList<>();
		sources.add("<keygeneration.RandomGenerator: java.lang.Double random()>");

		ArrayList<String> sinks = new ArrayList<>();
		sinks.add(print(PrintStream.class.getDeclaredMethod("println", Object.class)));
		List<String> epoints = new ArrayList<String>();

		epoints.add("<keygeneration.KeyGenerator: void main(java.lang.String[])>");
		infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
		infoflow.getResults();
	}

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public test() : void from class org.gravity.flowdroid.Example


	/**
	 * Search methods in the pm corresponding to the node and create correspondences
	 * for them
	 *
	 * @param asset The node for which correspondences should be found
	 * @return A stream of correspondences
	 */
	private Stream<Method2Element> mapToMethod(Element element) {
		List<Method2Element> list = new ArrayList<>();
		for (TMethod method : methods) {
			int rank = StringCompare.compare(element.getName(), method.getTName());
			if (rank > 0 && helper.canCreate(method, element, Collections.emptyMap())) {
				Method2Element corr = helper.createCorrespondence(method, element, rank);
				mapping.getSuggested().add(corr);
				list.add(corr);
			}
		}
		return list.stream();
	}

	/**
	 * Search methods in the pm corresponding to the node and create correspondences
	 * for them
	 *
	 * @param asset The node for which correspondences should be found
	 * @return A stream of correspondences
	 */
	private Stream<Method2Element> mapToMethod(Element element) {
		ArrayList<Method2Element> list = new ArrayList<Method2Element>();
		for (TMethod method : methods) {
			int rank = StringCompare.compare(element.getName(), method.getTName());
			if (rank > 0 && helper.canCreate(method, element, Collections.emptyMap())) {
				Method2Element corr = helper.createCorrespondence(method, element, rank);
				mapping.getSuggested().add(corr);
				list.add(corr);
			}
		}
		return list.stream();
	}

Replace Generic With Diamond ArrayList<Method2Element> with ArrayList<> in method private mapToMethod(element Element) : Stream<Method2Element> from class org.gravity.mapping.secdfd.Mapper


	/**
	 * Search classes in the pm corresponding to the asset and create
	 * correspondences for them
	 *
	 * @param entity The asset for which correspondences should be found
	 * @return A stream of correspondences
	 */
	private Stream<Type2NamedEntity> mapToType(NamedEntity entity) {
		List<Type2NamedEntity> list = new ArrayList<>();
		for (TAbstractType type : types) {
			int rank = StringCompare.compare(entity.getName(), type.getTName());
			if (rank > 0 && helper.canCreate(type, entity, Collections.emptyMap())) {
				Type2NamedEntity corr = helper.createCorrespondence(type, entity, rank);
				mapping.getSuggested().add(corr);
				list.add(corr);
			}
		}
		return list.stream();
	}

	/**
	 * Search classes in the pm corresponding to the asset and create
	 * correspondences for them
	 *
	 * @param entity The asset for which correspondences should be found
	 * @return A stream of correspondences
	 */
	private Stream<Type2NamedEntity> mapToType(NamedEntity entity) {
		ArrayList<Type2NamedEntity> list = new ArrayList<Type2NamedEntity>();
		for (TAbstractType type : types) {
			int rank = StringCompare.compare(entity.getName(), type.getTName());
			if (rank > 0 && helper.canCreate(type, entity, Collections.emptyMap())) {
				Type2NamedEntity corr = helper.createCorrespondence(type, entity, rank);
				mapping.getSuggested().add(corr);
				list.add(corr);
			}
		}
		return list.stream();
	}

Replace Generic With Diamond ArrayList<Type2NamedEntity> with ArrayList<> in method private mapToType(entity NamedEntity) : Stream<Type2NamedEntity> from class org.gravity.mapping.secdfd.Mapper


	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		ASTNode node = getSelectedASTNode(event);
		TypeGraph pm = mappingView.getProgramModel().getValue();

		List<EObject> selected = getSelectedPMElement(node, pm);
		if (selected == null || selected.isEmpty()) {
			LOGGER.log(Level.ERROR, "Cannot find element in model: " + node);
			return null;
		}
		DFDSelectionView dfdView;
		try {
			dfdView = (DFDSelectionView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
					.showView(DFDSelectionView.VIEW_ID);

		} catch (PartInitException e) {
			LOGGER.log(Level.ERROR, e);
			return false;
		}
		GravityUiActivator.getShell().getDisplay().asyncExec(() -> dfdView.populate(selected, mappingView));
		return null;
	}

	@Override
	public Object execute(ExecutionEvent event) throws ExecutionException {
		ASTNode node = getSelectedASTNode(event);
		TypeGraph pm = mappingView.getProgramModel().getValue();

		List<EObject> selected = getSelectedPMElement(node, pm);
		if (selected == null || selected.isEmpty()) {
			LOGGER.log(Level.ERROR, "Cannot find element in model: " + node);
			return null;
		}
		DFDSelectionView dfdView;
		try {
			dfdView = (DFDSelectionView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
					.showView(DFDSelectionView.VIEW_ID);

		} catch (PartInitException e) {
			LOGGER.log(Level.ERROR, e);
			return false;
		}
		GravityUiActivator.getShell().getDisplay().asyncExec(new Runnable() {

			@Override
			public void run() {
				dfdView.populate(selected, mappingView);
			}
		});
		return null;
	}

Replace Anonymous With Lambda org.gravity.mapping.secdfd.ui.handler.TextEditorHandler.execute.asyncExec.new Runnable with () -> dfdView.populate(selected,mappingView) in method public execute(event ExecutionEvent) : Object from class org.gravity.mapping.secdfd.ui.handler.TextEditorHandler


    private static JSONObject sendRequest(String address, int port, String request) {
        int retries = 0;

        while (true) {
            try (Socket socket = new Socket(address, port)) {
                socket.setSoTimeout(5000);
                System.out.println("Connected");

                DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
                BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));

                myClock.tick();
                myClock.log("GETClient: sending request");

                // Send the properly formatted request
                outputStream.writeBytes(request);

                String currentLine;
                StringBuilder responseHeader = new StringBuilder();
                StringBuilder responseBody = new StringBuilder();
                while ((currentLine = input.readLine()) != null && !currentLine.isEmpty()) {
                    responseHeader.append(currentLine).append("\n");
                    // Check if it's the response line and get return code
                    if (responseHeader.toString().startsWith("HTTP/")) {
                        String[] split = currentLine.trim().split(" ", 3);
                        int returnCode = Integer.parseInt(split[1]);
                        if (returnCode == 200) {
                            break; // Exit if response is OK
                        } else if (returnCode == 404) {
                            System.out.println("File not found");
                            return null; // Handle file not found error
                        } else {
                            System.out.println("Unknown error: " + returnCode);
                            retries++;
                            continue; // Retry for other errors
                        }
                    }
                }

                // Now read the body, which should be the JSON content
                while ((currentLine = input.readLine()) != null) {
                    responseBody.append(currentLine).append("\n");
                }

                // Parse the accumulated response body into JSON
                JSONObject jsonResponse = parseRawResponse(responseBody.toString());
                System.out.println(jsonResponse.toString(2));

                return jsonResponse;

            } catch (IOException i) {
                System.out.println("IOException: " + i.getMessage());
                retries++;
                if (retries > 3) {
                    System.out.println("Connection failed");
                    return null;
                }
            } catch (Exception e) {
                System.out.println("Error while parsing JSON: " + e.getMessage());
                return null;
            }
        }
    }

    private static JSONObject sendRequest(String address, int port, String request){
        int retries = 0;
        JSONObject result = null;
        while (true){
            try {
                Socket socket = new Socket(address, port);
                socket.setSoTimeout(5000);
                System.out.println("Connected");

                DataOutputStream outputStream = new DataOutputStream(socket.getOutputStream());
                BufferedReader input = new BufferedReader(new InputStreamReader(socket.getInputStream()));

                myClock.tick();
                myClock.log("GETClient: sending request");

                outputStream.writeUTF(request);

                String currentLine;
                if ((currentLine = input.readLine()) != null && !currentLine.isEmpty()) {
                    String [] split = currentLine.trim().split(" ", 3);
                    int returnCode = Integer.parseInt(split[1]);
                    if (returnCode == 200){
                        result = new JSONObject();
                        while ((currentLine = input.readLine()) != null && !currentLine.isEmpty()){
                            if (currentLine.startsWith("Lamport-Clock:")){
                                String [] tokens = currentLine.split(":", 2);
                                myClock.update(Integer.parseInt(tokens[1].trim()));
                                myClock.log("GETClient: receive response");
                                break;
                            }
                        }
                        while ((currentLine = input.readLine()) != null && !currentLine.isEmpty()){
                            if (currentLine.startsWith("{")){
                                JSONObject currentData = new JSONObject(currentLine);

                                result = currentData;
                                break;
                            }
                        }
                        socket.close();
                        outputStream.close();
                        input.close();
                        break;
                    } else if (returnCode == 404){
                        System.out.println("File not found");
                        socket.close();
                        outputStream.close();
                        input.close();
                        return null;
                    } else {
                        System.out.println("Unknown error");
                        retries ++;
                        continue;
                    }
                } else {
                    retries ++;
                    continue;
                }
            } catch (IOException i) {
                System.out.println(i);
                retries++;
                if (retries > 3){
                    System.out.println("Connection failed");
                    return null;
                }
            }
        }
        return result;
    }

Try With Resources try(Socket socket=new Socket(address,port)) in method private sendRequest(address String, port int, request String) : JSONObject from class com.client.GETClient


    public Map<String, Object> getMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("datephotoms", datePhoto.getTime());
        map.put("timeexecutionms", getTimeExecution());

        // a radar photo provide : main information
        map.put("label", label);
        map.put("name", name);
        map.put("listevents", BEventFactory.getHtml(listEvents));

        Map<String, Object> photo = new HashMap<>();
        map.put("photo", photo);

        //---------------- list of indicators
        List<Map<String, Object>> listMapIndicators = new ArrayList<Map<String, Object>>();

        for (IndicatorPhoto indicator : listIndicators) {

            listMapIndicators.add(indicator.getMap());

        }
        map.put("listindicators", listMapIndicators);

        //--------------- list of detail
        List<Map<String, Object>> listMapDetails = new ArrayList<>();
        for (DataHeaderPhoto headerPhoto : listHeader) {
            listMapDetails.add(headerPhoto.getMap());
        }
        map.put("listheaders", listMapDetails);
        map.put("listdata", listData);
        return map;
    }

    public Map<String, Object> getMap() {
        Map<String, Object> map = new HashMap<>();
        map.put("datephotoms", datePhoto.getTime());
        map.put("timeexecutionms", getTimeExecution());

        // a radar photo provide : main information
        map.put("label", label);
        map.put("name", name);
        map.put("listevents", BEventFactory.getHtml(listEvents));

        Map<String, Object> photo = new HashMap<>();
        map.put("photo", photo);

        //---------------- list of indicators
        List<Map<String, Object>> listMapIndicators = new ArrayList<Map<String, Object>>();

        for (IndicatorPhoto indicator : listIndicators) {

            listMapIndicators.add(indicator.getMap());

        }
        map.put("listindicators", listMapIndicators);

        //--------------- list of detail
        List<Map<String, Object>> listMapDetails = new ArrayList<Map<String, Object>>();
        for (DataHeaderPhoto headerPhoto : listHeader) {
            listMapDetails.add(headerPhoto.getMap());
        }
        map.put("listheaders", listMapDetails);
        map.put("listdata", listData);
        return map;
    }

Replace Generic With Diamond ArrayList<Map<String,Object>> with ArrayList<> in method public getMap() : Map<String,Object> from class org.bonitasoft.radar.RadarPhoto


    @Override
    public CloseableIteration<? extends Resource, SailException> getContextIDs()
            throws SailException {
        return new EmptyIteration<>();
    }

    @Override
    public CloseableIteration<? extends Resource, SailException> getContextIDs()
            throws SailException {
        return new EmptyIteration<Resource, SailException>();
    }

Replace Generic With Diamond EmptyIteration<Resource,SailException> with EmptyIteration<> in method public getContextIDs() : CloseableIteration<? extends Resource,SailException> from class sib.swiss.swissprot.sparql.ro.RoConnection


    /**
     * @brief Evaluates the given postfix expression.
     * @param exp the expression to evaluate.
     * @return the value of the given expression.
     * @exception IllegalArgumentException exp is not a valid postix expression.
     */
    public static int postfixEvaluate(final String exp) {
        Stack<Integer> s = new Stack<>();
        consumeExpression(s, exp);
        if (s.size() != 1) {
            throw new IllegalArgumentException("exp is not a proper postfix expression.");
        }
        return s.pop();
    }

    /**
     * @brief Evaluates the given postfix expression.
     * @param exp the expression to evaluate.
     * @return the value of the given expression.
     * @exception IllegalArgumentException exp is not a valid postix expression.
     */
    public static int postfixEvaluate(final String exp) {
        Stack<Integer> s = new Stack<Integer>();
        consumeExpression(s, exp);
        if (s.size() != 1) {
            throw new IllegalArgumentException("exp is not a proper postfix expression.");
        }
        return s.pop();
    }

Replace Generic With Diamond Stack<Integer> with Stack<> in method public postfixEvaluate(exp String) : int from class com.thealgorithms.stacks.StackPostfixNotation


    /**
     * Test searching for patterns that start at the beginning of the input text.
     * The expected position for each pattern is 0.
     */
    @Test
    void testPatternAtBeginning() {
        // Define patterns that start at the beginning of the text
        final var searchPatterns = new String[] {"GC", "GCA", "GCAT"};
        final var expected = Map.of("GC", new ArrayList<>(List.of(0)), "GCA", new ArrayList<>(List.of(0)), "GCAT", new ArrayList<>(List.of(0)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

    /**
     * Test searching for patterns that start at the beginning of the input text.
     * The expected position for each pattern is 0.
     */
    @Test
    void testPatternAtBeginning() {
        // Define patterns that start at the beginning of the text
        final var searchPatterns = new String[] {"GC", "GCA", "GCAT"};
        final var expected = Map.of("GC", new ArrayList<Integer>(Arrays.asList(0)), "GCA", new ArrayList<Integer>(Arrays.asList(0)), "GCAT", new ArrayList<Integer>(Arrays.asList(0)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method package testPatternAtBeginning() : void from class com.thealgorithms.strings.AhoCorasickTest


    /**
     * Test searching for patterns that end at the end of the input text.
     * The expected positions are 4, 3, and 2 for the patterns.
     */
    @Test
    void testPatternAtEnd() {
        // Define patterns that end at the end of the text
        final var searchPatterns = new String[] {"CG", "TCG", "ATCG"};
        final var expected = Map.of("CG", new ArrayList<>(List.of(4)), "TCG", new ArrayList<>(List.of(3)), "ATCG", new ArrayList<>(List.of(2)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

    /**
     * Test searching for patterns that end at the end of the input text.
     * The expected positions are 4, 3, and 2 for the patterns.
     */
    @Test
    void testPatternAtEnd() {
        // Define patterns that end at the end of the text
        final var searchPatterns = new String[] {"CG", "TCG", "ATCG"};
        final var expected = Map.of("CG", new ArrayList<Integer>(Arrays.asList(4)), "TCG", new ArrayList<Integer>(Arrays.asList(3)), "ATCG", new ArrayList<Integer>(Arrays.asList(2)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method package testPatternAtEnd() : void from class com.thealgorithms.strings.AhoCorasickTest


    /**
     * Test searching for patterns with multiple occurrences in the input text.
     * The expected sizes are 1 and 1, and the expected positions are 2 and 3
     * for the patterns "AT" and "T" respectively.
     */
    @Test
    void testMultipleOccurrencesOfPattern() {
        // Define patterns with multiple occurrences in the text
        final var searchPatterns = new String[] {"AT", "T"};
        final var expected = Map.of("AT", new ArrayList<>(List.of(2)), "T", new ArrayList<>(List.of(3)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

    /**
     * Test searching for patterns with multiple occurrences in the input text.
     * The expected sizes are 1 and 1, and the expected positions are 2 and 3
     * for the patterns "AT" and "T" respectively.
     */
    @Test
    void testMultipleOccurrencesOfPattern() {
        // Define patterns with multiple occurrences in the text
        final var searchPatterns = new String[] {"AT", "T"};
        final var expected = Map.of("AT", new ArrayList<Integer>(Arrays.asList(2)), "T", new ArrayList<Integer>(Arrays.asList(3)));
        assertEquals(expected, AhoCorasick.search(text, searchPatterns));
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method package testMultipleOccurrencesOfPattern() : void from class com.thealgorithms.strings.AhoCorasickTest


    public static void main(String[] args) {
        CircleLinkedList<Integer> cl = new CircleLinkedList<>();
        cl.append(12);
        System.out.println(cl);
        cl.append(23);
        System.out.println(cl);
        cl.append(34);
        System.out.println(cl);
        cl.append(56);
        System.out.println(cl);
        cl.remove(3);
        System.out.println(cl);
    }

    public static void main(String[] args) {
        CircleLinkedList cl = new CircleLinkedList<String>();
        cl.append(12);
        System.out.println(cl);
        cl.append(23);
        System.out.println(cl);
        cl.append(34);
        System.out.println(cl);
        cl.append(56);
        System.out.println(cl);
        cl.remove(3);
        System.out.println(cl);
    }

Replace Generic With Diamond CircleLinkedList<String> with CircleLinkedList<> in method public main(args String[]) : void from class com.thealgorithms.datastructures.lists.CircleLinkedList


    public static void main(String[] args) {
        try (Scanner sc = new Scanner(System.in)) {
            int i, res = 0;
            System.out.println("Enter the number of elements in the array");
            int n = sc.nextInt();
            if ((n & 1) == 1) {
                // Not allowing odd number of elements as we are expecting 2 non repeating
                // numbers
                System.out.println("Array should contain even number of elements");
                return;
            }
            int[] arr = new int[n];

            System.out.println("Enter " + n + " elements in the array. NOTE: Only 2 elements should not repeat");
            for (i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
            }

            try {
                sc.close();
            } catch (Exception e) {
                System.out.println("Unable to close scanner" + e);
            }

            // Find XOR of the 2 non repeating elements
            for (i = 0; i < n; i++) {
                res ^= arr[i];
            }

            // Finding the rightmost set bit
            res = res & (-res);
            int num1 = 0, num2 = 0;

            for (i = 0; i < n; i++) {
                if ((res & arr[i]) > 0) { // Case 1 explained below
                    num1 ^= arr[i];
                } else {
                    num2 ^= arr[i]; // Case 2 explained below
                }
            }

            System.out.println("The two non repeating elements are " + num1 + " and " + num2);
            sc.close();
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int i, res = 0;
        System.out.println("Enter the number of elements in the array");
        int n = sc.nextInt();
        if ((n & 1) == 1) {
            // Not allowing odd number of elements as we are expecting 2 non repeating numbers
            System.out.println("Array should contain even number of elements");
            return;
        }
        int[] arr = new int[n];

        System.out.println("Enter " + n + " elements in the array. NOTE: Only 2 elements should not repeat");
        for (i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }

        try {
            sc.close();
        } catch (Exception e) {
            System.out.println("Unable to close scanner" + e);
        }

        // Find XOR of the 2 non repeating elements
        for (i = 0; i < n; i++) {
            res ^= arr[i];
        }

        // Finding the rightmost set bit
        res = res & (-res);
        int num1 = 0, num2 = 0;

        for (i = 0; i < n; i++) {
            if ((res & arr[i]) > 0) { // Case 1 explained below
                num1 ^= arr[i];
            } else {
                num2 ^= arr[i]; // Case 2 explained below
            }
        }

        System.out.println("The two non repeating elements are " + num1 + " and " + num2);
        sc.close();
    }

Try With Resources try(Scanner sc=new Scanner(System.in)) in method public main(args String[]) : void from class com.thealgorithms.maths.NonRepeatingElement


    private synchronized void loadProperties() {
        try (FileInputStream file = new FileInputStream("src/main/java/io/automatenow/config/config.properties")) {
            properties = new Properties();
            properties.load(file);
            browser = properties.getProperty("browser");
            baseUrl = properties.getProperty("baseUrl");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private void loadProperties() {
        FileInputStream fis = null;

        try {
            properties = new Properties();
            fis = new FileInputStream("src\\main\\java\\io\\automatenow\\config\\config.properties");
            properties.load(fis);

            browser = properties.getProperty("browser");
            baseUrl = properties.getProperty("baseUrl");
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

Try With Resources try(FileInputStream file=new FileInputStream("src/main/java/io/automatenow/config/config.properties")) in method private loadProperties() : void from class io.automatenow.pages.BasePage


    /**
     * this method is called at the end of the game and adds victory points to the first two players that have
     * the highest battle points (first two on the military track)
     */
    public void applyVpOnBpRank() {
        HashMap<Player, Integer> milTrack = new HashMap<>(players.stream().collect(
                Collectors.toMap (player -> player, player -> player.getResources().getBattlePoints())));
        ArrayList<Integer> bpScores = new ArrayList<>(milTrack.values());
        Collections.sort(bpScores, Collections.reverseOrder());
        //get players with highest score
        ArrayList<Player> firstPlayers = new ArrayList<>(milTrack.entrySet().stream()
                .filter(pl -> pl.getValue().equals(bpScores.get(0)))
                .map(Map.Entry::getKey).collect(Collectors.toList()));
        firstPlayers.forEach(pl -> pl.setResources(pl.getResources().addVictoryPoints(ENDGAME_FIRSTVP_BONUS)));
        if (firstPlayers.size() < 2) {
            ArrayList<Player> secondPlayers = new ArrayList<>(milTrack.entrySet().stream()
                    .filter(pl -> pl.getValue().equals(bpScores.get(1)))
                    .map(Map.Entry::getKey).collect(Collectors.toList()));
            secondPlayers.forEach(pl -> pl.setResources(pl.getResources().addVictoryPoints(ENDGAME_SECONDVP_BONUS)));
        }
    }

    /**
     * this method is called at the end of the game and adds victory points to the first two players that have
     * the highest battle points (first two on the military track)
     */
    public void applyVpOnBpRank() {
        HashMap<Player, Integer> milTrack = new HashMap<>(players.stream().collect(
                Collectors.toMap (player -> player, player -> player.getResources().getBattlePoints())));
        ArrayList<Integer> bpScores = new ArrayList<>(milTrack.values());
        Collections.sort(bpScores, Collections.reverseOrder());
        //get players with highest score
        ArrayList<Player> firstPlayers = new ArrayList<Player>(milTrack.entrySet().stream()
                .filter(pl -> pl.getValue().equals(bpScores.get(0)))
                .map(Map.Entry::getKey).collect(Collectors.toList()));
        firstPlayers.forEach(pl -> pl.setResources(pl.getResources().addVictoryPoints(ENDGAME_FIRSTVP_BONUS)));
        if (firstPlayers.size() < 2) {
            ArrayList<Player> secondPlayers = new ArrayList<>(milTrack.entrySet().stream()
                    .filter(pl -> pl.getValue().equals(bpScores.get(1)))
                    .map(Map.Entry::getKey).collect(Collectors.toList()));
            secondPlayers.forEach(pl -> pl.setResources(pl.getResources().addVictoryPoints(ENDGAME_SECONDVP_BONUS)));
        }
    }

Replace Generic With Diamond ArrayList<Player> with ArrayList<> in method public applyVpOnBpRank() : void from class it.polimi.ingsw.lim.model.Game


    @Override
    public Book delete(Book toDelete) {
        String DELETE_QUERY = "DELETE FROM book WHERE book_id = ?";
        Book book = null;

        try (PreparedStatement statement = connection.prepareStatement(DELETE_QUERY)) {
            statement.setLong(1, toDelete.getBookId());
            int deletedRows = statement.executeUpdate();
            if (deletedRows > 0) {
                book = toDelete;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return book;
    }

    @Override
    public Book delete(Book toDelete) {
        String DELETE_QUERY = "DELETE FROM book WHERE book_id = ?;";
        Book book = null;

        try {
            PreparedStatement statement = connection.prepareStatement(DELETE_QUERY);
            statement.setLong(1, toDelete.getBookId());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();
            if (resultSet.next()) {
                toDelete.setBookId(Long.parseLong(resultSet.getString(1)));
                book = toDelete;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return book;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(DELETE_QUERY)) in method public delete(toDelete Book) : Book from class org.example.CRUDOperationImplementations.BookCrudOperations


    @Override
    public Subscriber save(Subscriber toSave) {
        String INSERT_QUERY = "INSERT INTO subscriber (subscriberName, sex) VALUES (?, ?)";
        Subscriber subscriber = null;

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS)) {

            statement.setString(1, toSave.getSubscriberName());
            statement.setString(2, toSave.getSex());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();

            if (resultSet.next()) {
                toSave.setSubscriberId(resultSet.getLong(1));
                subscriber = toSave;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return subscriber;
    }

    @Override
    public Subscriber save(Subscriber toSave) {
        String INSERT_QUERY = "INSERT INTO subscriber (subscriberName, sex) VALUES (?, ?);";
        Subscriber subscriber = null;

        try {
            PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS);
            statement.setString(1, toSave.getSubscriberName());
            statement.setString(2, toSave.getSex());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();

            if (resultSet.next()) {
                toSave.setSubscriberId(resultSet.getLong(1));
                subscriber = toSave;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return subscriber;
    }

Try With Resources try(Connection connection=DatabaseConnection.getConnection(); PreparedStatement statement=connection.prepareStatement(INSERT_QUERY,Statement.RETURN_GENERATED_KEYS)) in method public save(toSave Subscriber) : Subscriber from class org.example.CRUDOperationImplementations.SubscriberCrudOperations


    @Override
    public Subscriber delete(Subscriber toDelete) {
        String DELETE_QUERY = "DELETE FROM subscriber WHERE subscriberId = ?";

        try (Connection connection = DatabaseConnection.getConnection();
             PreparedStatement statement = connection.prepareStatement(DELETE_QUERY)) {

            statement.setLong(1, toDelete.getSubscriberId());
            statement.executeUpdate();
            return toDelete;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public Subscriber delete(Subscriber toDelete) {
        String DELETE_QUERY = "DELETE FROM subscriber WHERE subscriberId = ?";

        try {
            PreparedStatement statement = connection.prepareStatement(DELETE_QUERY);
            statement.setLong(1, toDelete.getSubscriberId());
            statement.executeUpdate();
            return toDelete;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }

Try With Resources try(Connection connection=DatabaseConnection.getConnection(); PreparedStatement statement=connection.prepareStatement(DELETE_QUERY)) in method public delete(toDelete Subscriber) : Subscriber from class org.example.CRUDOperationImplementations.SubscriberCrudOperations


    @Override
    public List<Subscriber> findAll() {
        String SELECT_ALL_QUERY = "SELECT * FROM subscriber;";
        List<Subscriber> subscribers = new ArrayList<>();

        try (PreparedStatement statement = connection.prepareStatement(SELECT_ALL_QUERY);
             ResultSet resultSet = statement.executeQuery()) {

            while (resultSet.next()) {
                subscribers.add(subscriberInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return subscribers;
    }

    @Override
    public List<Subscriber> findAll() {
        String SELECT_ALL_QUERY = "SELECT * FROM subscriber;";
        List<Subscriber> subscribers = new ArrayList<>();

        try {
            ResultSet resultSet = connection.prepareStatement(SELECT_ALL_QUERY).executeQuery();
            while (resultSet.next()) {
                subscribers.add(subscriberInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return subscribers;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(SELECT_ALL_QUERY); ResultSet resultSet=statement.executeQuery()) in method public findAll() : List<Subscriber> from class org.example.CRUDOperationImplementations.SubscriberCrudOperations


    @Override
    public List<Book> findAll() {
        String SELECT_ALL_QUERY = "SELECT * FROM book";
        List<Book> books = new ArrayList<>();

        try (PreparedStatement statement = connection.prepareStatement(SELECT_ALL_QUERY);
             ResultSet resultSet = statement.executeQuery()) {

            while (resultSet.next()) {
                books.add(bookInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return books;
    }

    @Override
    public List<Book> findAll() {
        String SELECT_ALL_QUERY = "SELECT * FROM book";
        List<Book> books = new ArrayList<>();

        try {
            ResultSet resultSet = connection.prepareStatement(SELECT_ALL_QUERY).executeQuery();
            while (resultSet.next()) {
                books.add(bookInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return books;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(SELECT_ALL_QUERY); ResultSet resultSet=statement.executeQuery()) in method public findAll() : List<Book> from class org.example.CRUDOperationImplementations.BookCrudOperations


    @Override
    public List<Author> findAll() {
        List<Author> authors = new ArrayList<>();

        try (PreparedStatement statement = connection.prepareStatement(SELECT_ALL_QUERY); ResultSet resultSet = statement.executeQuery()) {
            while (resultSet.next()) {
                authors.add(authorInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return authors;
    }

    @Override
    public List<Author> findAll() {
        String SELECT_ALL_QUERY = "SELECT * FROM author";
        List<Author> authors = new ArrayList<>();

        try {
            ResultSet resultSet = connection.prepareStatement(SELECT_ALL_QUERY).executeQuery();
            while (resultSet.next()) {
                authors.add(authorInstance(resultSet));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return authors;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(SELECT_ALL_QUERY); ResultSet resultSet=statement.executeQuery()) in method public findAll() : List<Author> from class org.example.CRUDOperationImplementations.AuthorCrudOperations


    @Override
    public Author save(Author toSave) {
        Author author = null;

        try (PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS)) {
            statement.setString(1, toSave.getAuthorName());
            statement.setString(2, toSave.getSex().toString());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();
            if (resultSet.next()) {
                toSave.setAuthorId(resultSet.getLong(1));
                author = toSave;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return author;
    }

    @Override
    public Author save(Author toSave) {
        String INSERT_QUERY = "INSERT INTO author (author_name, sex) VALUES (?, ?);";
        Author author = null;

        try {
            PreparedStatement statement = connection.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS);
            statement.setString(1, toSave.getAuthorName());
            statement.setString(2, toSave.getSex().toString());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();
            if (resultSet.next()) {
                toSave.setAuthorId(resultSet.getInt(1));
                author = toSave;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return author;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(INSERT_QUERY,Statement.RETURN_GENERATED_KEYS)) in method public save(toSave Author) : Author from class org.example.CRUDOperationImplementations.AuthorCrudOperations


    @Override
    public Author delete(Author toDelete) {
        Author author = null;

        try (PreparedStatement statement = connection.prepareStatement(DELETE_QUERY)) {
            statement.setLong(1, toDelete.getAuthorId());
            statement.executeUpdate();
            author = toDelete;
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return author;
    }

    @Override
    public Author delete(Author toDelete) {
        String DELETE_QUERY = "DELETE FROM author WHERE author_id = ?;";
        Author author = null;

        try {
            PreparedStatement statement = connection.prepareStatement(DELETE_QUERY);
            statement.setLong(1, toDelete.getAuthorId());
            statement.executeUpdate();

            ResultSet resultSet = statement.getGeneratedKeys();
            if (resultSet.next()) {
                toDelete.setAuthorId(Long.parseLong(resultSet.getString(1)));
                author = toDelete;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return author;
    }

Try With Resources try(PreparedStatement statement=connection.prepareStatement(DELETE_QUERY)) in method public delete(toDelete Author) : Author from class org.example.CRUDOperationImplementations.AuthorCrudOperations


    /**
     * Initializes the StartGamePanel panel.
     * @param size the size of the panel
     * @param mainmenu the mainmenu
     */
    public StartGamePanel(int size, MainMenu mainmenu) {
        super();
        initComponents();
        adjustSizes(size);

        this.menu = mainmenu;

        start_game_button.addActionListener((e)->{
            BlinkAnimator blink =  new BlinkAnimator(start_game_button, 80, true);
            blink.start();
            AudioEngine.play(EAudio.button_click, PlaybackMode.regular, new FunctionCallback() {
                @Override
                public void callback() {
                    blink.stop();
                    startGame();
                }
            });
        });
        back_button.addActionListener((e)->{
            BlinkAnimator blink =  new BlinkAnimator(back_button, 80, true);
            blink.start();
            AudioEngine.play(EAudio.button_click, PlaybackMode.regular, new FunctionCallback() {
                @Override
                public void callback(){
                    blink.stop();
                    menu.showMainPanel();
                }
            });
        });

        repaint();
    }

    /**
     * Initializes the StartGamePanel panel.
     * @param size the size of the panel
     * @param mainmenu the mainmenu
     */
    public StartGamePanel(int size, MainMenu mainmenu) {
        super();
        initComponents();
        adjustSizes(size);

        this.menu = mainmenu;

        ActionListener a = new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e){
                if (e.getSource().equals(start_game_button)) {
                    BlinkAnimator blink =  new BlinkAnimator(start_game_button, 80, true);
                    blink.start();
                    AudioEngine.play(EAudio.button_click, PlaybackMode.regular, new FunctionCallback() {
                        @Override
                        public void callback() {
                            blink.stop();
                            startGame();
                        }
                    });
                } else if (e.getSource().equals(back_button)) {
                    BlinkAnimator blink =  new BlinkAnimator(back_button, 80, true);
                    blink.start();
                    AudioEngine.play(EAudio.button_click, PlaybackMode.regular, new FunctionCallback() {
                        @Override
                        public void callback(){
                            blink.stop();
                            menu.showMainPanel();
                        }
                    });

                }
            }
        };
        start_game_button.addActionListener(a);
        back_button.addActionListener(a);

        repaint();
    }

Replace Anonymous With Lambda GUI.StartGamePanel.StartGamePanel.a.new ActionListener with (e) -> {BlinkAnimator blink=new BlinkAnimator(start_game_button,80,true); in method public StartGamePanel(size int, mainmenu MainMenu) from class GUI.StartGamePanel