    @SuppressWarnings("unchecked")
    private List<ExTipoDespacho> getTiposDespacho(final ExMobil mob) {
        final List<ExTipoDespacho> tiposDespacho = new ArrayList<>();
        tiposDespacho.add(new ExTipoDespacho(0L, "[Nenhum]", "S"));
        tiposDespacho.addAll(dao().consultarAtivos());
        tiposDespacho
                .add(new ExTipoDespacho(-1, "[Outros] (texto curto)", "S"));

        if (mob != null
                && Ex.getInstance().getComp()
                .pode(ExPodeCriarDocFilho.class, getTitular(), getLotaTitular(), mob))
            tiposDespacho.add(new ExTipoDespacho(-2, "[Outros] (texto longo)",
                    "S"));

        return tiposDespacho;
    }

    @SuppressWarnings("unchecked")
    private List<ExTipoDespacho> getTiposDespacho(final ExMobil mob) {
        final List<ExTipoDespacho> tiposDespacho = new ArrayList<ExTipoDespacho>();
        tiposDespacho.add(new ExTipoDespacho(0L, "[Nenhum]", "S"));
        tiposDespacho.addAll(dao().consultarAtivos());
        tiposDespacho
                .add(new ExTipoDespacho(-1, "[Outros] (texto curto)", "S"));

        if (mob != null
                && Ex.getInstance().getComp()
                .pode(ExPodeCriarDocFilho.class, getTitular(), getLotaTitular(), mob))
            tiposDespacho.add(new ExTipoDespacho(-2, "[Outros] (texto longo)",
                    "S"));

        return tiposDespacho;
    }

Replace Generic With Diamond ArrayList<ExTipoDespacho> with ArrayList<> in method private getTiposDespacho(mob ExMobil) : List<ExTipoDespacho> from class br.gov.jfrj.siga.vraptor.ExMovimentacaoController


    public Set<ExMovimentacao> getAssinaturasDigitais() {
        TreeSet<ExMovimentacao> movs = new TreeSet<>();
        movs.addAll(getApenasAssinaturas());
        movs.addAll(getApenasConferenciasCopia());
        return movs;
    }

    public Set<ExMovimentacao> getAssinaturasDigitais() {
        TreeSet<ExMovimentacao> movs = new TreeSet<ExMovimentacao>();
        movs.addAll(getApenasAssinaturas());
        movs.addAll(getApenasConferenciasCopia());
        return movs;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getAssinaturasDigitais() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas digitais.
     */
    public Set<ExMovimentacao> getApenasAssinaturas() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_DIGITAL_MOVIMENTACAO || m
                    .getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_MOVIMENTACAO_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas digitais.
     */
    public Set<ExMovimentacao> getApenasAssinaturas() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_DIGITAL_MOVIMENTACAO || m
                    .getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_MOVIMENTACAO_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasAssinaturas() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas com Token.
     */
    public Set<ExMovimentacao> getApenasAssinaturasComToken() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_DIGITAL_MOVIMENTACAO)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas com Token.
     */
    public Set<ExMovimentacao> getApenasAssinaturasComToken() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_DIGITAL_MOVIMENTACAO)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasAssinaturasComToken() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas com Senha.
     */
    public Set<ExMovimentacao> getApenasAssinaturasComSenha() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_MOVIMENTACAO_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo:
     * ASSINATURA_DIGITAL_MOVIMENTACAO.
     *
     * @return Coleção de movimentações de assinaturas com Senha.
     */
    public Set<ExMovimentacao> getApenasAssinaturasComSenha() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.ASSINATURA_MOVIMENTACAO_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasAssinaturasComSenha() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopia() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_DOCUMENTO || m
                    .getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopia() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_DOCUMENTO || m
                    .getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasConferenciasCopia() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia com token.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopiaComToken() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_DOCUMENTO)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia com token.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopiaComToken() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_DOCUMENTO)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasConferenciasCopiaComToken() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia com senha.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopiaComSenha() {
        Set<ExMovimentacao> set = new TreeSet<>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

    /**
     * Retorna uma coleção de movimentações dos tipo
     * CONFERENCIA_COPIA_DOCUMENTO.
     *
     * @return Coleção de movimentações de conferências de cópia com senha.
     */
    public Set<ExMovimentacao> getApenasConferenciasCopiaComSenha() {
        Set<ExMovimentacao> set = new TreeSet<ExMovimentacao>();

        for (ExMovimentacao m : getExMovimentacaoReferenciadoraSet()) {
            if ((m.getExTipoMovimentacao() == ExTipoDeMovimentacao.CONFERENCIA_COPIA_COM_SENHA)
                    && m.getExMovimentacaoCanceladora() == null) {
                set.add(m);
            }
        }
        return set;
    }

Replace Generic With Diamond TreeSet<ExMovimentacao> with TreeSet<> in method public getApenasConferenciasCopiaComSenha() : Set<ExMovimentacao> from class br.gov.jfrj.siga.ex.ExMovimentacao


    private static String getWebdavJwtToken(ExMovimentacao mov, DpPessoa cadastrante, DpPessoa titular,
                                            DpLotacao lotaTitular, String pwd) {
        String token;

        final JWTSigner signer = new JWTSigner(getWebdavPassword());
        final HashMap<String, Object> claims = new HashMap<>();

        // final long iat = System.currentTimeMillis() / 1000L; // issued at
        // claim
        // final long exp = iat + 48 * 60 * 60L; // token expires in 48 hours
        // claims.put("exp", exp);
        // claims.put("iat", iat);

        // Nato: tive que colocar tudo em uma string só para reduzir o tamanho
        // do JWT, pois o Word tem uma limitação no tamanho máximo da URL.
        claims.put("d", mov.mob().getReferencia() + "|" + cadastrante.getSiglaCompleta() + "|"
                + titular.getSiglaCompleta() + "|" + lotaTitular.getSiglaCompleta());
        // claims.put("mob", mov.mob().getReferencia());
        // claims.put("cad",cadastrante.getSiglaCompleta());
        // claims.put("tit",titular.getSiglaCompleta());
        // claims.put("lot",lotaTitular.getSiglaCompleta());
        token = signer.sign(claims);

        // Date agora = new Date();
        // Date expiraEm = new Date(agora.getTime() + 1000*60*60*48);
        // Builder jwtBuilder = JWT.create();
        // jwtBuilder.withIssuedAt(agora)
        // .withExpiresAt(expiraEm)
        // .withClaim("mob",mov.mob().getReferencia())
        // .withClaim("cad",cadastrante.getSiglaCompleta())
        // .withClaim("tit",titular.getSiglaCompleta())
        // .withClaim("lot",lotaTitular.getSiglaCompleta());
        //
        // token = jwtBuilder.sign(getWebdavJwtAlgorithm(pwd));

        return token.replace(JWT_FIXED_HEADER, JWT_FIXED_HEADER_REPLACEMENT).replace(".", "~");
    }

    private static String getWebdavJwtToken(ExMovimentacao mov, DpPessoa cadastrante, DpPessoa titular,
                                            DpLotacao lotaTitular, String pwd) {
        String token;

        final JWTSigner signer = new JWTSigner(getWebdavPassword());
        final HashMap<String, Object> claims = new HashMap<String, Object>();

        // final long iat = System.currentTimeMillis() / 1000L; // issued at
        // claim
        // final long exp = iat + 48 * 60 * 60L; // token expires in 48 hours
        // claims.put("exp", exp);
        // claims.put("iat", iat);

        // Nato: tive que colocar tudo em uma string só para reduzir o tamanho
        // do JWT, pois o Word tem uma limitação no tamanho máximo da URL.
        claims.put("d", mov.mob().getReferencia() + "|" + cadastrante.getSiglaCompleta() + "|"
                + titular.getSiglaCompleta() + "|" + lotaTitular.getSiglaCompleta());
        // claims.put("mob", mov.mob().getReferencia());
        // claims.put("cad",cadastrante.getSiglaCompleta());
        // claims.put("tit",titular.getSiglaCompleta());
        // claims.put("lot",lotaTitular.getSiglaCompleta());
        token = signer.sign(claims);

        // Date agora = new Date();
        // Date expiraEm = new Date(agora.getTime() + 1000*60*60*48);
        // Builder jwtBuilder = JWT.create();
        // jwtBuilder.withIssuedAt(agora)
        // .withExpiresAt(expiraEm)
        // .withClaim("mob",mov.mob().getReferencia())
        // .withClaim("cad",cadastrante.getSiglaCompleta())
        // .withClaim("tit",titular.getSiglaCompleta())
        // .withClaim("lot",lotaTitular.getSiglaCompleta());
        //
        // token = jwtBuilder.sign(getWebdavJwtAlgorithm(pwd));

        return token.replace(JWT_FIXED_HEADER, JWT_FIXED_HEADER_REPLACEMENT).replace(".", "~");
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method private getWebdavJwtToken(mov ExMovimentacao, cadastrante DpPessoa, titular DpPessoa, lotaTitular DpLotacao, pwd String) : String from class br.gov.jfrj.siga.ex.vo.ExMovimentacaoVO


    public static List<String> getIdList() {
        List<String> idList = new ArrayList<>();
        for (CpMarcadorGrupoEnum i : CpMarcadorGrupoEnum.values()) {
            idList.add((i.id).toString());
        }
        return idList;
    }

    public static List<String> getIdList() {
        List<String> idList = new ArrayList<String>();
        for (CpMarcadorGrupoEnum i : CpMarcadorGrupoEnum.values()) {
            idList.add((i.id).toString());
        }
        return idList;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method public getIdList() : List<String> from class br.gov.jfrj.siga.cp.model.enm.CpMarcadorGrupoEnum


    private List<SigaIdDescr> getListaTipoRelatorio() {
        ArrayList<SigaIdDescr> lista = new ArrayList<>();

        lista.add(new SigaIdDescr(1, "Estatísticas gerais"));
        lista.add(new SigaIdDescr(2, "Tempo de documentos"));
        lista.add(new SigaIdDescr(3, "Tempo de documentos detalhado"));
        return lista;
    }

	private List<SigaIdDescr> getListaTipoRelatorio() {
		ArrayList<SigaIdDescr> lista = new ArrayList<SigaIdDescr>();

		lista.add(new SigaIdDescr(1, "Estatísticas gerais"));
		lista.add(new SigaIdDescr(2, "Tempo de documentos"));
		lista.add(new SigaIdDescr(3, "Tempo de documentos detalhado"));
		return lista;
	}

Replace Generic With Diamond ArrayList<SigaIdDescr> with ArrayList<> in method private getListaTipoRelatorio() : List<SigaIdDescr> from class br.gov.jfrj.siga.wf.vraptor.WfRelatorioController


    public CSVReader() {
        data = new ArrayList<>();
    }

    public CSVReader() {
        data = new ArrayList<CSVRecord>();
    }

Replace Generic With Diamond ArrayList<CSVRecord> with ArrayList<> in method public CSVReader() from class com.example.CSVReader


    public InstructionBlock() {
        lines = new ArrayList<>();
    }

    public InstructionBlock() {
        lines = new ArrayList<SmaliLine>();
    }

Replace Generic With Diamond ArrayList<SmaliLine> with ArrayList<> in method public InstructionBlock() from class com.momoyeyu.smali_analyzer.entity.InstructionBlock


    public ImportPackageList() {
        this.list = new ArrayList<>();
    }

    public ImportPackageList() {
        this.list = new LinkedList<String>();
    }

Replace Generic With Diamond LinkedList<String> with ArrayList<> in method public ImportPackageList() from class com.momoyeyu.smali_analyzer.utils.ImportPackageList


    private void writeSourceMap(final File sourceMapFile, final String sourceFileName, final SourceMap sourceMap,
                final String outputDir, final Log log) {
        try (final FileWriter out = new FileWriter(sourceMapFile)) {
            sourceMap.appendTo(out, sourceFileName);
            out.flush();
        }
        catch (final Exception e) {
            log.error("Failed to write an JavaScript Source Map file for " + sourceFileName, e);
        }

        // move the file
        moveToSourceMapDir(sourceMapFile, outputDir, log);
    }

    private void writeSourceMap(final File sourceMapFile, final String sourceFileName, final SourceMap sourceMap,
                final String outputDir, final Log log) {
        try {
            final FileWriter out = new FileWriter(sourceMapFile);
            sourceMap.appendTo(out, sourceFileName);
            out.flush();
            IOUtil.close(out);
        }
        catch (final Exception e) {
            log.error("Failed to write an JavaScript Source Map file for " + sourceFileName, e);
        }

        // move the file
        moveToSourceMapDir(sourceMapFile, outputDir, log);
    }

Try With Resources try(final FileWriter out=new FileWriter(sourceMapFile)) in method private writeSourceMap(sourceMapFile File, sourceFileName String, sourceMap SourceMap, outputDir String, log Log) : void from class org.primefaces.extensions.optimizerplugin.optimizer.ClosureCompilerOptimizer


	@Override
	public Match deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
		throws IOException {

		JsonNode rootNode = jsonParser.getCodec().readTree(jsonParser);
		JsonNode typeNameNode = rootNode.get("typeName");

		Match match = MatchFactory.getMatch(typeNameNode.asText());

		JsonNode wrestlersNode = rootNode.get("wrestlers");
		if (wrestlersNode != null) {
			ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
			TreeTraversingParser wrestlerFieldsParser = new TreeTraversingParser(wrestlersNode, mapper);
			wrestlerFieldsParser.nextToken();
			Collection<Wrestler> wrestlers = mapper.readValue(wrestlerFieldsParser, new TypeReference<>() {
			});

			match.setWrestlers(wrestlers);
		}

		JsonNode stipulationNode = rootNode.get("stipulations");
		if (stipulationNode != null) {
			ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
			TreeTraversingParser stipulationFieldsParser = new TreeTraversingParser(stipulationNode, mapper);
			stipulationFieldsParser.nextToken();
			Collection<Stipulation> stipulations = mapper.readValue(stipulationFieldsParser, new TypeReference<>() {
			});

			match.setStipulations(stipulations);
		}

		return match;
	}

	@Override
	public Match deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
		throws IOException {

		JsonNode rootNode = jsonParser.getCodec().readTree(jsonParser);
		JsonNode typeNameNode = rootNode.get("typeName");

		Match match = MatchFactory.getMatch(typeNameNode.asText());

		JsonNode wrestlersNode = rootNode.get("wrestlers");
		if (wrestlersNode != null) {
			ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
			TreeTraversingParser wrestlerFieldsParser = new TreeTraversingParser(wrestlersNode, mapper);
			wrestlerFieldsParser.nextToken();
			Collection<Wrestler> wrestlers = mapper.readValue(wrestlerFieldsParser, new TypeReference<Collection<Wrestler>>() {
			});

			match.setWrestlers(wrestlers);
		}

		JsonNode stipulationNode = rootNode.get("stipulations");
		if (stipulationNode != null) {
			ObjectMapper mapper = (ObjectMapper) jsonParser.getCodec();
			TreeTraversingParser stipulationFieldsParser = new TreeTraversingParser(stipulationNode, mapper);
			stipulationFieldsParser.nextToken();
			Collection<Stipulation> stipulations = mapper.readValue(stipulationFieldsParser, new TypeReference<Collection<Stipulation>>() {
			});

			match.setStipulations(stipulations);
		}

		return match;
	}

Replace Generic With Diamond TypeReference<Collection<Wrestler>> with TypeReference<> in method public deserialize(jsonParser JsonParser, deserializationContext DeserializationContext) : Match from class dev.indoors.ringrats.core.deserializer.MatchDeserializer


    static void BFS(int s, int d, Routes routes) {
        if (s == d) {
            System.out.println("O vértice de origem é igual ao vértice de destino.");
            return;
        }

        // Marque todos os vértices como não visitados (por padrão, definido como falso)
        boolean[] visited = new boolean[routes.numberOfAirports];
        int[] parent = new int[routes.numberOfAirports];

        // Crie uma fila para BFS
        ListaEncadeada<Integer> queue = new ListaEncadeada<>();

        // Marque o nó atual como visitado e coloque-o na fila
        visited[s] = true;
        queue.add(s);
        parent[s] = -1;  // O vértice de origem não tem pai

        while (!queue.isEmpty()) {
            // Desenfileire um vértice da fila
            int currentVertex = queue.poll();

            // Obtenha todos os vértices adjacentes ao vértice desenfileirado currentVertex.
            // Se um adjacente não foi visitado, marque-o como visitado e enfileire-o
            for (int n = 0; n < routes.numberOfAirports; n++) {
                if (routes.adjacencyMatrix[currentVertex][n] != 0 && !visited[n]) {
                    visited[n] = true;
                    queue.add(n);
                    parent[n] = currentVertex;

                    // Se o destino for encontrado, pare a busca
                    if (n == d) {
                        printPath(parent, s, d, routes);
                        return;
                    }
                }
            }
        }

        System.out.println("Não existe caminho do vértice " + s + " para o vértice " + d);
    }

    static void BFS(int s, int d, Routes routes) {
        if (s == d) {
            System.out.println("O vértice de origem é igual ao vértice de destino.");
            return;
        }

        // Marque todos os vértices como não visitados (por padrão, definido como falso)
        boolean[] visited = new boolean[routes.numberOfAirports];
        int[] parent = new int[routes.numberOfAirports];

        // Crie uma fila para BFS
        ListaEncadeada<Integer> queue = new ListaEncadeada<Integer>();

        // Marque o nó atual como visitado e coloque-o na fila
        visited[s] = true;
        queue.add(s);
        parent[s] = -1;  // O vértice de origem não tem pai

        while (!queue.isEmpty()) {
            // Desenfileire um vértice da fila
            int currentVertex = queue.poll();

            // Obtenha todos os vértices adjacentes ao vértice desenfileirado currentVertex.
            // Se um adjacente não foi visitado, marque-o como visitado e enfileire-o
            for (int n = 0; n < routes.numberOfAirports; n++) {
                if (routes.adjacencyMatrix[currentVertex][n] != 0 && !visited[n]) {
                    visited[n] = true;
                    queue.add(n);
                    parent[n] = currentVertex;

                    // Se o destino for encontrado, pare a busca
                    if (n == d) {
                        printPath(parent, s, d, routes);
                        return;
                    }
                }
            }
        }

        System.out.println("Não existe caminho do vértice " + s + " para o vértice " + d);
    }

Replace Generic With Diamond ListaEncadeada<Integer> with ListaEncadeada<> in method package BFS(s int, d int, routes Routes) : void from class edu.ifmg.Relatorys


    public static void writeFile(String filePath, byte[] data) throws IOException {
        try (RandomAccessFile raf = new RandomAccessFile(filePath, "rw")) {
            raf.write(data);
        }
    }

    public static void writeFile(String filePath, byte[] data) throws IOException {
        RandomAccessFile raf = null;
        try {
            raf = new RandomAccessFile(filePath, "rw");
            raf.write(data);
        } finally {
            if (raf != null) {
                raf.close();
            }
        }
    }

Try With Resources try(RandomAccessFile raf=new RandomAccessFile(filePath,"rw")) in method public writeFile(filePath String, data byte[]) : void from class org.zz.gmhelper.test.util.FileUtil


    public static byte[] readFile(String filePath) throws IOException {
        byte[] data;
        try (RandomAccessFile raf = new RandomAccessFile(filePath, "r")) {
            data = new byte[(int) raf.length()];
            raf.read(data);
            return data;
        }
    }

    public static byte[] readFile(String filePath) throws IOException {
        RandomAccessFile raf = null;
        byte[] data;
        try {
            raf = new RandomAccessFile(filePath, "r");
            data = new byte[(int) raf.length()];
            raf.read(data);
            return data;
        } finally {
            if (raf != null) {
                raf.close();
            }
        }
    }

Try With Resources try(RandomAccessFile raf=new RandomAccessFile(filePath,"r")) in method public readFile(filePath String) : byte[] from class org.zz.gmhelper.test.util.FileUtil


    public VersionInfo() {
        Properties p = new Properties();
        try (InputStream is = VersionInfo.class.getResourceAsStream("/version.properties")) {
            p.load(is);
            version = p.getProperty("version");
            buildNumber = p.getProperty("buildNumber");
            buildInfo = p.getProperty("buildInfo");
            timestamp = p.getProperty("timestamp");
            scmBranch = p.getProperty("scmBranch");
        }
        catch (IOException e) {
            throw new RuntimeException("Error loading properties file", e);
        }
    }

    public VersionInfo() {
        Properties p = new Properties();
        InputStream is = null;
        try {
            is = VersionInfo.class.getResourceAsStream("/version.properties");
            p.load(is);
            version = p.getProperty("version");
            buildNumber = p.getProperty("buildNumber");
            buildInfo = p.getProperty("buildInfo");
            timestamp = p.getProperty("timestamp");
            scmBranch = p.getProperty("scmBranch");
        }
        catch (IOException e) {
            throw new AssertionError(e);
        }
        finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException ex) {
                    // InputSream lezárásakor hiba
                }
            }
        }
    }

Try With Resources try(InputStream is=VersionInfo.class.getResourceAsStream("/version.properties")) in method public VersionInfo() from class jtechlog.versioninfo.VersionInfo


    @Override
    public Iterator<T> iterator() {
        return new Iterator<>() {
            private final Object[] data = dataList;
            private final int dataSize = size;
            private int point = 0;

            @Override
            public boolean hasNext() {
                return point < dataSize;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                return (T) data[point++];
            }
        };
    }

    @Override
    public Iterator<T> iterator() {
        return new Iterator<T>() {
            private final Object[] data = dataList;
            private final int dataSize = size;
            private int point = 0;

            @Override
            public boolean hasNext() {
                return point < dataSize;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                return (T) data[point++];
            }
        };
    }

Replace Generic With Diamond Iterator<T> with Iterator<> in method public iterator() : Iterator<T> from class ru.job4j.generics.SimpleArray


    private AdvancedCacheLoader<String, Tuple<Optional<List<EntryData>>>> getLoader() {
        return (String key, long currentTime, CacheEntry<String, Tuple<Optional<List<EntryData>>>> currentEntry) -> {
            boolean alreadyLoaded = currentEntry != null;
            boolean previousException = alreadyLoaded && currentEntry.getException() != null;
            long lastReadTime = alreadyLoaded && !previousException ? currentEntry.getValue().lastModified : NEUTRAL;
            String providerName = provider.getName();
            Tuple<Optional<List<EntryData>>> result;
            try {
                Optional<List<EntryData>> value = provider.readEntries(key, lastReadTime);
                result = new Tuple<>(value, currentTime, true);
            } catch (CodelistNotChangedException e) {
                LOG.debug("[{}] Reload successful, but codelist {} did not change.", providerName, key);
                result = currentEntry.getValue().updateLastModified(currentTime).setChangedByReload(false);
            } catch (CodelistNotFoundException e) {
                if (alreadyLoaded) {
                    LOG.warn("[{}] Source system is probably down or codelist was removed. "
                            + "Returning old cached value for {}", providerName, key);
                    result = currentEntry.getValue().setChangedByReload(false);
                } else {
                    LOG.error("[{}] Codelist {} not found or source system is down!", providerName, key);
                    throw e;
                }
            }
            return result;
        };
    }

    private AdvancedCacheLoader<String, Tuple<Optional<List<EntryData>>>> getLoader() {
        return new AdvancedCacheLoader<String, Tuple<Optional<List<EntryData>>>>() {
            @Override
            public Tuple<Optional<List<EntryData>>> load(String key, long currentTime, CacheEntry<String, Tuple<Optional<List<EntryData>>>> currentEntry) throws Exception {
                boolean alreadyLoaded = currentEntry != null;
                boolean previousException = alreadyLoaded && currentEntry.getException() != null;
                long lastReadTime = alreadyLoaded && !previousException ? currentEntry.getValue().lastModified : NEUTRAL;
                String providerName = provider.getName();
                Tuple<Optional<List<EntryData>>> result;
                try {
                    Optional<List<EntryData>> value = provider.readEntries(key, lastReadTime);
                    result = new Tuple<>(value, currentTime, true);
                } catch (CodelistNotChangedException e) {
                    LOG.debug("[{}] Reload successful, but codelist {} did not change.", providerName, key);
                    result = currentEntry.getValue().updateLastModified(currentTime).setChangedByReload(false);
                } catch (CodelistNotFoundException e) {
                    if (alreadyLoaded) {
                        LOG.warn("[{}] Source system is probably down or codelist was removed. "
                                + "Returning old cached value for {}", providerName, key);
                        result = currentEntry.getValue().setChangedByReload(false);
                    } else {
                        LOG.error("[{}] Codelist {} not found or source system is down!", providerName, key);
                        throw e;
                    }
                }
                return result;
            }
        };
    }

Replace Anonymous With Lambda camp.xit.jacod.cache2k.CachedDataProvider.getLoader.new AdvancedCacheLoader<String,Tuple<Optional<List<EntryData>>>> with (key, currentTime, currentEntry) -> {boolean alreadyLoaded=currentEntry != null; in method private getLoader() : AdvancedCacheLoader<String,Tuple<Optional<List<EntryData>>>> from class camp.xit.jacod.cache2k.CachedDataProvider


    private boolean dropTable() {
        String drop = """
                 DROP TABLE IF EXISTS card;
                """;
        try (var prepareStatement = connection.prepareStatement(drop)) {
            return prepareStatement.execute();
        } catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }

    private boolean dropTable() {
        try {
            var x = connection.prepareStatement("""
                     DROP TABLE IF EXISTS card;
                    """);
            return x.execute();
        } catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }

Try With Resources try(var prepareStatement=connection.prepareStatement(drop)) in method private dropTable() : boolean from class banking.DAO.ContextDataBase


    private boolean createTableUser() {
        String createUserTable = """
                CREATE TABLE IF NOT EXISTS USER(
                id integer  PRIMARY KEY,
                pin text NOT NULL,
                number text NOT NULL,
                balance integer DEFAULT 0);
                 """;
        try (var preparedStatement = connection.prepareStatement(createUserTable)) {

            return preparedStatement.execute();

        } catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }

    private boolean createTableUser() {
        try {
            var x = connection.prepareStatement("""
                    CREATE TABLE IF NOT EXISTS USER(
                    id integer  PRIMARY KEY,
                    pin text NOT NULL,
                    number text NOT NULL,
                    balance integer DEFAULT 0);
                     """);
            return x.execute();
        } catch (SQLException e) {
            e.printStackTrace();
            return false;
        }
    }

Try With Resources try(var preparedStatement=connection.prepareStatement(createUserTable)) in method private createTableUser() : boolean from class banking.DAO.ContextDataBase


    @Override
    public int addUser(User user) {
        String insertUser = """
                INSERT INTO card
                (pin,number)
                VALUES(?,?);
                 """;
        try (var statement = connection.prepareStatement(insertUser)) {
            statement.setString(1, user.getCard()
                                       .getPIN()
                                       .toString());
            statement.setString(2, user.getCard()
                                       .getNumber());

            return statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }

    @Override
    public int addUser(User user) {
        try {
            var statement = connection.prepareStatement("""
                    INSERT INTO card
                    (pin,number)
                    VALUES(?,?);
                    CREATE TABLE IF NOT EXISTS card(
                    id integer  PRIMARY KEY,
                    pin varchar(30) NOT NULL,
                    balance integer DEFAULT 0);
                     """);
            statement.setString(1, user.getCard()
                                       .getPIN()
                                       .toString());
            statement.setString(2, user.getCard()
                                       .getNumber());
            return statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return -1;
    }

Try With Resources try(var statement=connection.prepareStatement(insertUser)) in method public addUser(user User) : int from class banking.DAO.ContextDataBase


    private static Properties loadProperties() {
        PROPERTIES = new Properties();
        try(FileInputStream ls = new FileInputStream(CONFIG_FILE_NAME)){
            PROPERTIES.load(ls);
        } catch (IOException e) {
            throw new RuntimeException("Couldn't prepare config properties", e);
        }
        return PROPERTIES;
    }

    private static Properties loadProperties() {
        Properties config = new Properties();
        try {
            InputStream ls = Config.class.getClassLoader().getResourceAsStream(CONFIG_FILE_NAME);
            config.load(ls);
        } catch (IOException e) {
            throw new RuntimeException("Couldn't prepare config properties", e);
        }
        return config;
    }

Try With Resources try(FileInputStream ls=new FileInputStream(CONFIG_FILE_NAME)) in method private loadProperties() : Properties from class com.laba.solvd.bank.config.Config


    @Override
    public void create(Customer customer) {
        Connection connection = CONNECTION_POOL.getConnection();
        try(PreparedStatement prepareStatement= connection.prepareStatement("INSERT INTO customers (firstName, lastName) VALUES (?, ?)", Statement.RETURN_GENERATED_KEYS)){
            prepareStatement.setString(2, customer.getFirstName());
            prepareStatement.setString(3, customer.getLastName());
            prepareStatement.executeUpdate();
            ResultSet resultSet=prepareStatement.getGeneratedKeys();
            while(resultSet.next()){
                customer.setId(resultSet.getLong("id"));
            }
        } catch (SQLException e) {
            logger.info("Failed to create customer", e);
        } finally {
            CONNECTION_POOL.releaseConnection(connection);
        }
    }

    @Override
    public void create(Customer customer) {
        Connection connection = connectionPool.getConnection();
        try {
            String sql = "INSERT INTO customers (id, firstName, lastName) VALUES (?, ?, ?)";
            PreparedStatement statement = connection.prepareStatement(sql);
            statement.setInt(1, customer.getId());
            statement.setString(2, customer.getFirstName());
            statement.setString(3, customer.getLastName());

            statement.executeUpdate();
        } catch (SQLException e) {
            throw new RuntimeException("Failed to create customer", e);
        } finally {
            connectionPool.releaseConnection(connection);
        }
    }

Try With Resources try(PreparedStatement prepareStatement=connection.prepareStatement("INSERT INTO customers (firstName, lastName) VALUES (?, ?)",Statement.RETURN_GENERATED_KEYS)) in method public create(customer Customer) : void from class com.laba.solvd.bank.dao.impl.CustomerRepositoryImpl


    private Collection<Robot<?>> evolveSEgeno(IndependentFactory<List<Double>> factory, RobotMapper mapper, Function<Robot<?>, Outcome> trainingTask) throws ExecutionException, InterruptedException {
        Evolver<List<Double>, Robot<?>, Outcome> evolver = new SpeciatedEvolver<>(mapper, factory, PartialComparator.from(Outcome.class).reversed().comparing(Individual::getFitness), 100, Map.of(new GaussianMutation(0.35D), 0.02D, new GeometricCrossover(Range.closed(-1.0D, 2.0D)), 0.08D),
                5, new KMeansSpeciator<>(10, 200, new LNorm(2), individual -> {
                                        List<Double> g = individual.getGenotype();
                                        double[] out = new double[g.size()];
                                        for (int i = 0; i < g.size(); ++i) {
                                          out[i] = g.get(i);
                                        }
                                        return out;
                                    }), 0.75, false);
        return evolver.solve(trainingTask, new Births(nBirths), new Random(seed), this.executorService, createListenerFactory().build());
    }

    private Collection<Robot<?>> evolveSEgeno(IndependentFactory<List<Double>> factory, RobotMapper mapper, Function<Robot<?>, Outcome> trainingTask) throws FileNotFoundException, ExecutionException, InterruptedException {
        Listener<? super List<Double>, ? super Robot<?>, ? super Double> newListener = createListener(trainingTask);
        Evolver<List<Double>, Robot<?>, Double> evolver = new SpeciatedEvolver<List<Double>, Robot<?>, Double>(mapper, factory, PartialComparator.from(Double.class).reversed().comparing(Individual::getFitness), 100, Map.of(new GaussianMutation(0.35D), 0.02D, new GeometricCrossover(Range.closed(-1.0D, 2.0D)), 0.08D),
                5, new KMeansSpeciator<>(10, 200, new LNorm(2), individual -> {
                                        List<Double> g = individual.getGenotype();
                                        double[] out = new double[g.size()];
                                        for (int i = 0; i < g.size(); ++i) {
                                          out[i] = g.get(i);
                                        }
                                        return out;
                                    }), 0.75);
        return evolver.solve(trainingTask.andThen(Outcome::getDistance), new Births(nBirths), new Random(seed), this.executorService, Listener.onExecutor(newListener, this.executorService));
    }

Replace Generic With Diamond SpeciatedEvolver<List<Double>,Robot<?>,Double> with SpeciatedEvolver<> in method private evolveSEgeno(factory IndependentFactory<List<Double>>, mapper RobotMapper, trainingTask Function<Robot<?>,Outcome>) : Collection<Robot<?>> from class Main


    public ChannelFuture bootstrap() throws InterruptedException {

        Bootstrap bootstrap = new Bootstrap();

        // Configure the server
        bootstrap.group(new NioEventLoopGroup())
                .channel(NioSocketChannel.class)
                .handler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    protected void initChannel(SocketChannel ch) {
                        ch.pipeline()
                                .addLast(new LoggingHandler("CLIENT LOGGER", LogLevel.INFO))
                                .addLast(new ProtobufDecoder(Messages.WrapperMessage.getDefaultInstance()))
                                .addLast(new ProtobufEncoder())
                                .addLast(new IdleStateHandler(0, hbInterval, 0))
                                .addLast(channelHandler);
                    }
                });
        // Bind and start to accept incoming connections.
        ChannelFuture tcpChannel = bootstrap.connect(host, port);

        tcpChannel.addListener((ChannelFutureListener) future -> {
            if(future.isSuccess()) {
                logger.info("Client Connected to Server on Port :: {}", port);
            } else {
                logger.error("Error connecting to Server. Host :: {} Port :: {}", host, port);
                System.exit(0);
            }
        });

        return tcpChannel;

    }

    public void bootstrap() throws InterruptedException {

        Bootstrap bootstrap = new Bootstrap();

        // Configure the server
        bootstrap.group(new NioEventLoopGroup())
                .channel(NioSocketChannel.class)
                .handler(new ChannelInitializer<SocketChannel>() {
                    @Override
                    protected void initChannel(SocketChannel ch) {
                        ch.pipeline()
                                .addLast(new LoggingHandler("CLIENT LOGGER", LogLevel.INFO))
                                .addLast(new ProtobufDecoder(Messages.WrapperMessage.getDefaultInstance()))
                                .addLast(new ProtobufEncoder())
                                .addLast(new IdleStateHandler(0, hbInterval, 0))
                                .addLast(channelHandler);
                    }
                });
        // Bind and start to accept incoming connections.
        ChannelFuture httpChannel = bootstrap.connect(host, port);

        httpChannel.addListener(new ChannelFutureListener() {
            @Override
            public void operationComplete(ChannelFuture future) throws Exception {
                if(future.isSuccess()) {
                    logger.info("Client Connected to Server on Port :: {}", port);
                } else {
                    logger.error("Error connecting to Server. Host :: {} Port :: {}", host, port);
                    System.exit(0);
                }
            }
        });

        // Wait until server socket is closed
        httpChannel.channel().closeFuture().sync();

    }

Replace Anonymous With Lambda org.naveedh.ClientBootstrap.bootstrap.addListener.new ChannelFutureListener with future -> {if(future.isSuccess()){logger.info("Client Connected to Server on Port :: {}",port); in method public bootstrap() : ChannelFuture from class org.naveedh.ClientBootstrap


    private int[][] processInput(List<String> input, int expansionGrade){
        List<int[]> galaxies = new ArrayList<>();
        int[][] result;
        int offsetY=0;
        int step=0;
        int[] offsetX=new int[input.get(0).length()];
        Arrays.fill(offsetX, expansionGrade);

        for (int i=0;i<input.size();i++){
            if (input.get(i).indexOf('#')==-1)
                offsetY+=expansionGrade;
            while ((step=input.get(i).indexOf('#', step))!=-1){
                galaxies.add(new int[]{step, i+offsetY});
                offsetX[step]=0;
                step++;
            }
        }
        for(int i=0; i<offsetX.length;i++){
            if (i!=0)
                offsetX[i] = offsetX[i-1] + 1 + offsetX[i];
        }
        result=new int[galaxies.size()][];
        for (int i =0; i<galaxies.size();i++){
            result[i]=new int[]{offsetX[galaxies.get(i)[0]], galaxies.get(i)[1]};
        }
        return result;
    }

    private int[][] processInput(List<String> input, int expansionGrade){
        List<int[]> galaxies = new ArrayList<int[]>();
        int[][] result;
        int offsetY=0;
        int step=0;
        int[] offsetX=new int[input.get(0).length()];
        Arrays.fill(offsetX, expansionGrade);

        for (int i=0;i<input.size();i++){
            if (input.get(i).indexOf('#')==-1)
                offsetY+=expansionGrade;
            while ((step=input.get(i).indexOf('#', step))!=-1){
                galaxies.add(new int[]{step, i+offsetY});
                offsetX[step]=0;
                step++;
            }
        }
        for(int i=0; i<offsetX.length;i++){
            if (i!=0)
                offsetX[i] = offsetX[i-1] + 1 + offsetX[i];
        }
        result=new int[galaxies.size()][];
        for (int i =0; i<galaxies.size();i++){
            result[i]=new int[]{offsetX[galaxies.get(i)[0]], galaxies.get(i)[1]};
        }
        return result;
    }

Replace Generic With Diamond ArrayList<int[]> with ArrayList<> in method private processInput(input List<String>, expansionGrade int) : int[][] from class de.gfed.AoC_2023.DayEleven


    private int followThePipe ( int[] pos, List<String> input){
        int result=1;
        List<int[]> loop = new ArrayList<>();
        loop.add(new int[]{pos[0], pos[1]});
        do {
            pos=getNextPipeAndQuadrantIn(pos, input.get(pos[0]).charAt(pos[1]), pos[2]);
            loop.add(new int[]{pos[0], pos[1]});
            result++;
        }
        while (pos[0]!=-1 && input.get(pos[0]).charAt(pos[1]) !='S');
        loops.add(loop);
        return pos[0]==-1 || input.get(pos[0]).charAt(pos[1]) !='S'? -1:  result/2 ;

    }

    private int followThePipe ( int[] pos, List<String> input){
        int result=1;
        List<int[]> loop = new ArrayList<int[]>();
        loop.add(new int[]{pos[0], pos[1]});
        do {
            pos=getNextPipeAndQuadrantIn(pos, input.get(pos[0]).charAt(pos[1]), pos[2]);
            loop.add(new int[]{pos[0], pos[1]});
            result++;
        }
        while (pos[0]!=-1 && input.get(pos[0]).charAt(pos[1]) !='S');
        loops.add(loop);
        return pos[0]==-1 || input.get(pos[0]).charAt(pos[1]) !='S'? -1:  result/2 ;

    }

Replace Generic With Diamond ArrayList<int[]> with ArrayList<> in method private followThePipe(pos int[], input List<String>) : int from class de.gfed.AoC_2023.DayTen


    private  List<Integer[]> buildListOfNumbers(List<String> input) {
        List<Integer[]> result = new ArrayList<>();
        Pattern digitRegex = Pattern.compile("\\d+");
        String line;
        for (int i = 0; i < input.size(); i++) {
            line = input.get(i);
            Matcher digitMatcher = digitRegex.matcher(line);
            while (digitMatcher.find()) {
                Integer[] item = {Integer.parseInt(line.substring(digitMatcher.start(), digitMatcher.end()))
                        , i, digitMatcher.start()};
                result.add(item);
            }
        }
        return result;
    }

    private  List<Integer[]> buildListOfNumbers(List<String> input) {
        List<Integer[]> result = new ArrayList<Integer[]>();
        Pattern digitRegex = Pattern.compile("\\d+");
        String line;
        for (int i = 0; i < input.size(); i++) {
            line = input.get(i);
            Matcher digitMatcher = digitRegex.matcher(line);
            while (digitMatcher.find()) {
                Integer[] item = {Integer.parseInt(line.substring(digitMatcher.start(), digitMatcher.end()))
                        , i, digitMatcher.start()};
                result.add(item);
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<Integer[]> with ArrayList<> in method private buildListOfNumbers(input List<String>) : List<Integer[]> from class de.gfed.AoC_2023.DayThree


    private  List<Integer[]> buildListOfSymbols(List<String> input, String regEx) {
        List<Integer[]> result = new ArrayList<>();
        Pattern digitRegex = Pattern.compile(regEx);
        String line;
        for (int i = 0; i < input.size(); i++) {
            line = input.get(i);
            Matcher digitMatcher = digitRegex.matcher(line);
            while (digitMatcher.find()) {
                Integer[] item = {i, digitMatcher.start()};
                result.add(item);
            }
        }
        return result;
    }

    private  List<Integer[]> buildListOfSymbols(List<String> input, String regEx) {
        List<Integer[]> result = new ArrayList<Integer[]>();
        Pattern digitRegex = Pattern.compile(regEx);
        String line;
        for (int i = 0; i < input.size(); i++) {
            line = input.get(i);
            Matcher digitMatcher = digitRegex.matcher(line);
            while (digitMatcher.find()) {
                Integer[] item = {i, digitMatcher.start()};
                result.add(item);
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<Integer[]> with ArrayList<> in method private buildListOfSymbols(input List<String>, regEx String) : List<Integer[]> from class de.gfed.AoC_2023.DayThree


    private  int maxCubeProduct(String line){
        String[] games= line.substring(line.indexOf(":")+1).split(";");
        Map<String, Integer> maxDiceLoc  = new HashMap<>() {{
            put("red", 0);
            put("green", 0);
            put("blue", 0);
        }};
        Arrays.stream(games).forEach(game ->{
            updateMaxCubes(maxDiceLoc, game);
        });
        return maxDiceLoc.values().stream().reduce(1, (a,b) -> a*b);
    }

    private  int maxCubeProduct(String line){
        String[] games= line.substring(line.indexOf(":")+1).split(";");
        Map<String, Integer> maxDiceLoc  = new HashMap<String, Integer>() {{
            put("red", 0);
            put("green", 0);
            put("blue", 0);
        }};
        Arrays.stream(games).forEach(game ->{
            updateMaxCubes(maxDiceLoc, game);
        });
        return maxDiceLoc.values().stream().reduce(1, (a,b) -> a*b);
    }

Replace Generic With Diamond HashMap<String,Integer> with HashMap<> in method private maxCubeProduct(line String) : int from class de.gfed.AoC_2023.DayTwo


    private  List<String> unfoldForPartTwo(List<String> input) {
        List<String> result = new ArrayList<>();
        input.forEach(line ->{
            result.add(
                    String.join("?", Collections.nCopies(5, line.substring(0, line.indexOf(" ")))) + " " +
                            String.join(",", Collections.nCopies(5, line.substring(line.indexOf(" ")+1)))
            );
        });
        return result;
    }

    private  List<String> unfoldForPartTwo(List<String> input) {
        List<String> result = new ArrayList<String>();
        input.forEach(line ->{
            result.add(
                    String.join("?", Collections.nCopies(5, line.substring(0, line.indexOf(" ")))) + " " +
                            String.join(",", Collections.nCopies(5, line.substring(line.indexOf(" ")+1)))
            );
        });
        return result;
    }

Replace Generic With Diamond ArrayList<String> with ArrayList<> in method private unfoldForPartTwo(input List<String>) : List<String> from class de.gfed.AoC_2023.DayTwelve


    @Override
    public JsonNode readJsonFile(String pathToJsonFile) {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode rootNode = null;
        try{
            URL filePath = getClass().getClassLoader().getResource(pathToJsonFile);
            if (filePath==null){
                throw new IOException("Resource not found, filepath for jsonTables file is null");
            }
            rootNode = mapper.readTree(new File(filePath.toURI()));
            // Print the map to see the content
            System.out.println(rootNode);
        } catch (IOException | URISyntaxException e) {
            e.printStackTrace();
        }
        return rootNode;
    }

    @Override
    public JsonNode readJsonFile(String pathToJsonFile) {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode rootNode = null;
        try{
            URL filePath = getClass().getClassLoader().getResource(pathToJsonFile);
            if (filePath==null){
                throw new IOException("Resource not found, filepath for jsonTables file is null");
            }
            rootNode = mapper.readTree(new File(filePath.toURI()));
            // Print the map to see the content
            System.out.println(rootNode);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        return rootNode;
    }

Merge Catch [catch(IOException e), catch(URISyntaxException e)] to catch(IOException|URISyntaxException e) in method public readJsonFile(pathToJsonFile String) : JsonNode from class io.github.fededa.inputhandler.InputHandler


    /**
     * Creates an immutable tuple with 2 arguments.
     *
     * @param <A>
     *     - The first argument type.
     * @param <B>
     *     - The second argument type.
     * @param a
     *     - The first object.
     * @param b
     *     - The second object.
     * @return The tuple.
     */
    public static <A, B> Tuple2<A, B> of(A a, B b)
    {
        return new Tuple2<>(a, b);
    }

    /**
     * Creates an immutable tuple with 2 arguments.
     *
     * @param <A>
     *     - The first argument type.
     * @param <B>
     *     - The second argument type.
     * @param a
     *     - The first object.
     * @param b
     *     - The second object.
     * @return The tuple.
     */
    public static <A, B> Tuple2<A, B> of(A a, B b)
    {
        return new Tuple2<A, B>(a, b);
    }

Replace Generic With Diamond Tuple2<A,B> with Tuple2<> in method public of(a A, b B) : Tuple2<A,B> from class net.whg.we.util.Tuple


    /**
     * Returns the game id from the file
     * @param nickname
     * @return
     */
    public int getLastGameId(String nickname) {
        //game data related to the player is stored in a json file named after the nickname the player had in that game
        String gameId = null;
        String time = null;
        JSONParser parser = new JSONParser();
        File file = new File(path + "/" + nickname + ".json");

        try (InputStream is = new FileInputStream(file);
             Reader reader = new InputStreamReader(Objects.requireNonNull(is, "Couldn't find json file"), StandardCharsets.UTF_8)) {
            JSONObject obj = (JSONObject) parser.parse(reader);
            gameId = (String) obj.get(DefaultValue.gameIdData);
            time = (String) obj.get(DefaultValue.gameIdTime);
        } catch (ParseException | IOException ex) {
            return -1;
        }
        assert gameId != null;
        if (LocalDateTime.parse(time).isBefore(LocalDateTime.now().plusSeconds(DefaultValue.twelveHS)))
            return Integer.parseInt(gameId);
        else
            return -1;
    }

    /**
     * Returns the game id from the file
     * @param nickname
     * @return
     */
    public int getLastGameId(String nickname) {
        //game data related to the player is stored in a json file named after the nickname the player had in that game
        String gameId = null;
        String time = null;
        JSONParser parser = new JSONParser();
        File file = new File(path + "/" + nickname + ".json");

        try (InputStream is = new FileInputStream(file);
             Reader reader = new InputStreamReader(Objects.requireNonNull(is, "Couldn't find json file"), StandardCharsets.UTF_8)) {
            JSONObject obj = (JSONObject) parser.parse(reader);
            gameId = (String) obj.get(DefaultValue.gameIdData);
            time = (String) obj.get(DefaultValue.gameIdTime);
        } catch (ParseException | FileNotFoundException ex) {
            System.out.println("No file found with nickname: "+nickname);
            return -1;
        } catch (IOException e) {
            return -1;
        }
        assert gameId != null;
        if (LocalDateTime.parse(time).isBefore(LocalDateTime.now().plusSeconds(DefaultValue.twelveHS)))
            return Integer.parseInt(gameId);
        else
            return -1;
    }

Merge Catch [catch(ParseException|FileNotFoundException ex), catch(IOException e)] to catch(ParseException|IOException ex) in method public getLastGameId(nickname String) : int from class polimi.ingsw.view.flow.utilities.FileDisconnection


    public static synchronized void playSound(final String soundName) {
        if (play) {
            new Thread(() -> {
                try {
                    Clip clip = AudioSystem.getClip();

                    InputStream in = Sound.class.getResourceAsStream("/audio/" + soundName);

                    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                    byte[] buffer = new byte[4096];
                    int bytesRead;
                    while (true) {
                        assert in != null;
                        if ((bytesRead = in.read(buffer)) == -1) break;
                        outputStream.write(buffer, 0, bytesRead);
                    }
                    byte[] audioData = outputStream.toByteArray();

                    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData);

                    AudioInputStream inputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);

                    clip.open(inputStream);
                    FloatControl gainControl =
                            (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
                    gainControl.setValue(-10.0f);
                    clip.start();
                } catch (Exception e) {
                    System.err.println(e.getMessage());
                }
            }).start();
        }
    }

    public static synchronized void playSound(final String soundname) {
        if(play) {
            new Thread(new Runnable() {
                public void run() {
                    try {
                        Clip clip = AudioSystem.getClip();

                        InputStream in = Sound.class.getResourceAsStream("/audio/"+soundname);

                        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
                        byte[] buffer = new byte[4096];
                        int bytesRead;
                        while ((bytesRead = in.read(buffer)) != -1) {
                            outputStream.write(buffer, 0, bytesRead);
                        }
                        byte[] audioData = outputStream.toByteArray();

                        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(audioData);

                        AudioInputStream inputStream = AudioSystem.getAudioInputStream(byteArrayInputStream);

                        clip.open(inputStream);
                        FloatControl gainControl =
                                (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
                        gainControl.setValue(-10.0f);
                        clip.start();
                    } catch (Exception e) {
                        System.err.println(e.getMessage());
                    }
                }
            }).start();
        }
    }

Replace Anonymous With Lambda polimi.ingsw.view.gui.Sound.playSound.start.new Thread.new Runnable with () -> {tryClip clip=AudioSystem.getClip(); in method public playSound(soundName String) : void from class polimi.ingsw.view.gui.Sound


    /**
     * Constructor
     */
    public Chat() {
        msgs = new ArrayList<>();
    }

    /**
     * Constructor
     */
    public Chat() {
        msgs = new ArrayList<Message>();
    }

Replace Generic With Diamond ArrayList<Message> with ArrayList<> in method public Chat() from class polimi.ingsw.model.chat.Chat


    public void clearInHandTile() {
        inHandTile = new ArrayList<>();
    }

    public void clearInHandTile() {
        inHandTile = new ArrayList<Tile>();
    }

Replace Generic With Diamond ArrayList<Tile> with ArrayList<> in method public clearInHandTile() : void from class polimi.ingsw.model.Player


    public Queue<PointIC> getPoints_IC(){
        return new ArrayDeque<>(points);
    }

    public Queue<PointIC> getPoints_IC(){
        return new ArrayDeque<PointIC>(points);
    }

Replace Generic With Diamond ArrayDeque<PointIC> with ArrayDeque<> in method public getPoints_IC() : Queue<PointIC> from class polimi.ingsw.model.cards.common.CommonCard


    @Override
    public void run() {
        EventElement event;

        try {
            ui.show_publisher();
            events.add(null, APP_MENU);
        } catch (IOException | InterruptedException e) {
            throw new RuntimeException(e);
        }

        while (!Thread.interrupted()) {
            if (events.isJoined()) {
                //Get one event
                event = events.pop();
                if (event != null) {
                    //if something happened
                    switch (event.getModel().getStatus()) {
                        case WAIT -> {
                            try {
                                statusWait(event);
                            } catch (IOException | InterruptedException e) {
                                throw new RuntimeException(e);
                            }
                        }
                        case RUNNING,LAST_CIRCLE -> {
                            try {
                                statusRunning(event);
                            } catch (IOException | InterruptedException e) {
                                throw new RuntimeException(e);
                            }
                        }
                        case ENDED -> statusEnded(event);
                    }
                }
            } else {
                event = events.pop();
                if (event != null) {
                    statusNotInAGame(event);
                }
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

    @Override
    public void run() {
        EventElement event;

        try {
            ui.show_publisher();
            events.add(null, APP_MENU);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        while (!Thread.interrupted()) {
            if (events.isJoined()) {
                //Get one event
                event = events.pop();
                if (event != null) {
                    //if something happened
                    switch (event.getModel().getStatus()) {
                        case WAIT -> {
                            try {
                                statusWait(event);
                            } catch (IOException | InterruptedException e) {
                                throw new RuntimeException(e);
                            }
                        }
                        case RUNNING,LAST_CIRCLE -> {
                            try {
                                statusRunning(event);
                            } catch (IOException | InterruptedException e) {
                                throw new RuntimeException(e);
                            }
                        }
                        case ENDED -> statusEnded(event);
                    }
                }
            } else {
                event = events.pop();
                if (event != null) {
                    statusNotInAGame(event);
                }
            }
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }

Merge Catch [catch(IOException e), catch(InterruptedException e)] to catch(IOException|InterruptedException e) in method public run() : void from class polimi.ingsw.view.userView.GameFlow


    public void positionTileOnShelf(int column, TileType type) {
        try {
            gameController.positionTileOnShelf(nickname, column, type);
        } catch (RemoteException | GameEndedException e) {
            throw new RuntimeException(e);
        }
    }

    public void positionTileOnShelf(int column, TileType type) {
        try {
            gameController.positionTileOnShelf(nickname, column, type);
        } catch (RemoteException e) {
            throw new RuntimeException(e);
        } catch (GameEndedException e) {
            throw new RuntimeException(e);
        }
    }

Merge Catch [catch(RemoteException e), catch(GameEndedException e)] to catch(RemoteException|GameEndedException e) in method public positionTileOnShelf(column int, type TileType) : void from class polimi.ingsw.view.networking.RMI.RMIClient


    private MainController() {
        runningGames = new ArrayList<>();
    }

    private MainController() {
        runningGames = new ArrayList<GameController>();
    }

Replace Generic With Diamond ArrayList<GameController> with ArrayList<> in method private MainController() from class polimi.ingsw.controller.MainController


    public BufferData(){
        data = new ArrayDeque<>();
    }

    public BufferData(){
        data = new ArrayDeque<String>();
    }

Replace Generic With Diamond ArrayDeque<String> with ArrayDeque<> in method public BufferData() from class polimi.ingsw.View.userView.text.BufferData


    /**
     * Get the list containing the points that a @param card will distribute when satisfied
     *
     * @param card the card which point will be added
     * @return the list of points to add to the @param card
     */
    private Queue<Point> getListPointForCommonCard(CommonCard card) {
        //Creo i punti per la carta
        Queue<Point> ris = new ArrayDeque<>();
        for (int i = 0; i < DefaultValue.pointsValue.length; i++)
            ris.add(new Point(DefaultValue.pointsValue[i], card.getCommonType()));

        return ris;
    }

    /**
     * Get the list containing the points that a @param card will distribute when satisfied
     *
     * @param card the card which point will be added
     * @return the list of points to add to the @param card
     */
    private Queue<Point> getListPointForCommonCard(CommonCard card) {
        //Creo i punti per la carta
        Queue<Point> ris = new ArrayDeque<Point>();
        for (int i = 0; i < DefaultValue.pointsValue.length; i++)
            ris.add(new Point(DefaultValue.pointsValue[i], card.getCommonType()));

        return ris;
    }

Replace Generic With Diamond ArrayDeque<Point> with ArrayDeque<> in method private getListPointForCommonCard(card CommonCard) : Queue<Point> from class polimi.ingsw.Controller.GameController


    @Test
    @DisplayName("Check Player List")
    void testPlayersList() {
        if (model.getNumOfPlayers() != 0) {
            fail("First init contains players");
        }

        for (int i = 0; i < 3; i++) {
            Player p = new Player(Integer.toString(i));

            try {
                try {
                    model.addPlayer(p);
                } catch (MaxPlayersInException e) {
                    fail("Player not added because game is full but that's not true");
                }
            } catch (PlayerAlreadyInException e) {
                fail("Player not added because of double but that's not true");
            }

            if (model.getNumOfPlayers() != (i + 1)) {
                fail("Wanted to add a player but never added");
            }
            if (!model.getPlayer(i).equals(p)) {
                fail("Player added isn't the corrent one");
            }

        }

        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("0")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("1")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("2")));

        try {
            model.addPlayer(new Player("3"));

        } catch (PlayerAlreadyInException | MaxPlayersInException e) {
            throw new RuntimeException(e);
        }

        assertThrows(MaxPlayersInException.class, () -> model.addPlayer(new Player("4")));

        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("0")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("1")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("2")));

    }

    @Test
    @DisplayName("Check Player List")
    void testPlayersList() {
        if (model.getNumOfPlayers() != 0) {
            fail("First init contains players");
        }

        for (int i = 0; i < 3; i++) {
            Player p = new Player(Integer.toString(i));

            try {
                try {
                    model.addPlayer(p);
                } catch (MaxPlayersInException e) {
                    fail("Player not added because game is full but that's not true");
                }
            } catch (PlayerAlreadyInException e) {
                fail("Player not added because of double but that's not true");
            }

            if (model.getNumOfPlayers() != (i + 1)) {
                fail("Wanted to add a player but never added");
            }
            if (!model.getPlayer(i).equals(p)) {
                fail("Player added isn't the corrent one");
            }

        }

        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("0")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("1")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("2")));

        try {
            model.addPlayer(new Player("3"));

        } catch (PlayerAlreadyInException e) {
            throw new RuntimeException(e);
        } catch (MaxPlayersInException e) {
            throw new RuntimeException(e);
        }

        assertThrows(MaxPlayersInException.class, () -> model.addPlayer(new Player("4")));

        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("0")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("1")));
        assertThrows(PlayerAlreadyInException.class, () -> model.addPlayer(new Player("2")));

    }

Merge Catch [catch(PlayerAlreadyInException e), catch(MaxPlayersInException e)] to catch(PlayerAlreadyInException|MaxPlayersInException e) in method package testPlayersList() : void from class polimi.ingsw.Model.GameModelTest


    public Map<Player,CardGoal> getGoalCards(){
        Map<Player, CardGoal> ris = new HashMap<>();

        for(Player p: players){
            ris.put(p,p.getSecretGoal());
        }
        return ris;
    }

    public Map<Player,CardGoal> getGoalCards(){
        Map ris = new HashMap<Player,CardGoal>();

        for(Player p: players){
            ris.put(p,p.getSecretGoal());
        }
        return ris;
    }

Replace Generic With Diamond HashMap<Player,CardGoal> with HashMap<> in method public getGoalCards() : Map<Player,CardGoal> from class polimi.ingsw.Model.GameModel


    public CardCommon(CardCommonType type){
        points = new ArrayDeque<>();
        commonType=type;
    }

    public CardCommon(CardCommonType type){
        points = new ArrayDeque<Point>();
        commonType=type;
    }

Replace Generic With Diamond ArrayDeque<Point> with ArrayDeque<> in method public CardCommon(type CardCommonType) from class polimi.ingsw.Model.Cards.Common.CardCommon


  private void reconnectImpl() throws Exception {
    LOG.debug("reconnectImpl");
    closeImpl();
    try (CloseableHolder<Connection> connHolder = new CloseableHolder<>(factory_.newConnection());
         CloseableHolder<Channel> chHolder = new CloseableHolder<>(connHolder.get().createChannel())){
      Channel channel = chHolder.get();
      String queue = channel.queueDeclare().getQueue();
      channel.exchangeDeclare(REQUEST_EXCHANGE, BuiltinExchangeType.DIRECT);
      channel.basicConsume(queue, new Consumer() {
        @Override
        public void handleConsumeOk(String consumerTag) {
          // TODO Auto-generated method stub
        }

        @Override
        public void handleCancelOk(String consumerTag) {
          // TODO Auto-generated method stub

        }

        @Override
        public void handleCancel(String consumerTag) throws IOException {
          // TODO Auto-generated method stub

        }

        @Override
        public void handleDelivery(
          String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException {
          if (config_.corellator != null) {
            config_.corellator.setCorellationId(properties.getCorrelationId());
          }
          String exchangeName = envelope.getExchange();
          if (exchangeName.isEmpty()) {
            handleResponse(body, properties.getMessageId());
          } else {
            handleRequest(
              envelope.getRoutingKey(), properties.getAppId(), body,
              properties.getMessageId(), properties.getReplyTo());
          }
        }

        @Override
        public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) {
          // TODO Auto-generated method stub
        }

        @Override
        public void handleRecoverOk(String consumerTag) {
          // TODO Auto-generated method stub

        }
      });
      connection_ = connHolder.release();
      channel_ = chHolder.release();
      ownQueue_ = queue;
    }
  }

  private void reconnectImpl() throws IOException, TimeoutException {
    LOG.debug("reconnectImpl");
    closeImpl();
    Connection connection = null;
    Channel channel = null;
    try {
      connection = factory_.newConnection();
      channel = connection.createChannel();
      String queue = channel.queueDeclare().getQueue();
      channel.exchangeDeclare(REQUEST_EXCHANGE, BuiltinExchangeType.DIRECT);
      channel.basicConsume(queue, new Consumer() {
        @Override
        public void handleConsumeOk(String consumerTag) {
          // TODO Auto-generated method stub
        }

        @Override
        public void handleCancelOk(String consumerTag) {
          // TODO Auto-generated method stub

        }

        @Override
        public void handleCancel(String consumerTag) throws IOException {
          // TODO Auto-generated method stub

        }

        @Override
        public void handleDelivery(
          String consumerTag, Envelope envelope, BasicProperties properties, byte[] body) throws IOException {
          if (config_.corellator != null) {
            config_.corellator.setCorellationId(properties.getCorrelationId());
          }
          String exchangeName = envelope.getExchange();
          if (exchangeName.isEmpty()) {
            handleResponse(body, properties.getMessageId());
          } else {
            handleRequest(
              envelope.getRoutingKey(), properties.getAppId(), body,
              properties.getMessageId(), properties.getReplyTo());
          }
        }

        @Override
        public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) {
          // TODO Auto-generated method stub
        }

        @Override
        public void handleRecoverOk(String consumerTag) {
          // TODO Auto-generated method stub

        }
      });
      connection_ = connection;
      channel_ = channel;
      ownQueue_ = queue;
      connection = null;
      channel = null;
    } finally {
      silentClose(channel);
      silentClose(connection);
    }
  }

Try With Resources try(CloseableHolder<Connection> connHolder=new CloseableHolder<>(factory_.newConnection()); CloseableHolder<Channel> chHolder=new CloseableHolder<>(connHolder.get().createChannel())) in method private reconnectImpl() : void from class com.duspensky.jutils.rmqrmi.GatewayImpl


    @Override
    public RecordStream<Pair<Key, Value>> entries() {
        return () -> new Iterator<>() {
            final Iterator<Map.Entry<Key, Value>> entryIterator = mvMap.entrySet().iterator();

            @Override
            public boolean hasNext() {
                return entryIterator.hasNext();
            }

            @Override
            public Pair<Key, Value> next() {
                Map.Entry<Key, Value> entry = entryIterator.next();
                return new Pair<>(entry.getKey(), entry.getValue());
            }
        };
    }

    @Override
    public RecordStream<Pair<Key, Value>> entries() {
        return () -> new Iterator<Pair<Key, Value>>() {
            final Iterator<Map.Entry<Key, Value>> entryIterator = mvMap.entrySet().iterator();

            @Override
            public boolean hasNext() {
                return entryIterator.hasNext();
            }

            @Override
            public Pair<Key, Value> next() {
                Map.Entry<Key, Value> entry = entryIterator.next();
                return new Pair<>(entry.getKey(), entry.getValue());
            }
        };
    }

Replace Generic With Diamond Iterator<Pair<Key,Value>> with Iterator<> in method public entries() : RecordStream<Pair<Key,Value>> from class org.dizitart.no2.mvstore.NitriteMVMap


    /**
     * Returns the iterable entries of the indexed items.
     *
     * @return the iterable
     */
    public Iterable<? extends Pair<Comparable<?>, ?>> entries() {
        if (nitriteMap != null) {
            Iterator<? extends Pair<DBValue, ?>> entryIterator;
            if (!reverseScan) {
                entryIterator = nitriteMap.entries().iterator();
            } else {
                entryIterator = nitriteMap.reversedEntries().iterator();
            }

            return (Iterable<Pair<Comparable<?>, ?>>) () -> new Iterator<>() {
                @Override
                public boolean hasNext() {
                    return entryIterator.hasNext();
                }

                @Override
                public Pair<Comparable<?>, ?> next() {
                    Pair<DBValue, ?> next = entryIterator.next();
                    DBValue dbKey = next.getFirst();
                    if (dbKey instanceof DBNull) {
                        return new Pair<>(null, next.getSecond());
                    } else {
                        return new Pair<>(dbKey.getValue(), next.getSecond());
                    }
                }
            };
        } else if (navigableMap != null) {
            Iterator<? extends Map.Entry<DBValue, ?>> entryIterator;
            if (reverseScan) {
                entryIterator = navigableMap.descendingMap().entrySet().iterator();
            } else {
                entryIterator = navigableMap.entrySet().iterator();
            }

            return (Iterable<Pair<Comparable<?>, ?>>) () -> new Iterator<Pair<Comparable<?>, ?>>() {
                @Override
                public boolean hasNext() {
                    return entryIterator.hasNext();
                }

                @Override
                public Pair<Comparable<?>, ?> next() {
                    Map.Entry<DBValue, ?> next = entryIterator.next();
                    DBValue dbKey = next.getKey();
                    if (dbKey instanceof DBNull) {
                        return new Pair<>(null, next.getValue());
                    } else {
                        return new Pair<>(dbKey.getValue(), next.getValue());
                    }
                }
            };
        }
        return Collections.EMPTY_SET;
    }

    /**
     * Returns the iterable entries of the indexed items.
     *
     * @return the iterable
     */
    public Iterable<? extends Pair<Comparable<?>, ?>> entries() {
        if (nitriteMap != null) {
            Iterator<? extends Pair<DBValue, ?>> entryIterator;
            if (!reverseScan) {
                entryIterator = nitriteMap.entries().iterator();
            } else {
                entryIterator = nitriteMap.reversedEntries().iterator();
            }

            return (Iterable<Pair<Comparable<?>, ?>>) () -> new Iterator<Pair<Comparable<?>, ?>>() {
                @Override
                public boolean hasNext() {
                    return entryIterator.hasNext();
                }

                @Override
                public Pair<Comparable<?>, ?> next() {
                    Pair<DBValue, ?> next = entryIterator.next();
                    DBValue dbKey = next.getFirst();
                    if (dbKey instanceof DBNull) {
                        return new Pair<>(null, next.getSecond());
                    } else {
                        return new Pair<>(dbKey.getValue(), next.getSecond());
                    }
                }
            };
        } else if (navigableMap != null) {
            Iterator<? extends Map.Entry<DBValue, ?>> entryIterator;
            if (reverseScan) {
                entryIterator = navigableMap.descendingMap().entrySet().iterator();
            } else {
                entryIterator = navigableMap.entrySet().iterator();
            }

            return (Iterable<Pair<Comparable<?>, ?>>) () -> new Iterator<Pair<Comparable<?>, ?>>() {
                @Override
                public boolean hasNext() {
                    return entryIterator.hasNext();
                }

                @Override
                public Pair<Comparable<?>, ?> next() {
                    Map.Entry<DBValue, ?> next = entryIterator.next();
                    DBValue dbKey = next.getKey();
                    if (dbKey instanceof DBNull) {
                        return new Pair<>(null, next.getValue());
                    } else {
                        return new Pair<>(dbKey.getValue(), next.getValue());
                    }
                }
            };
        }
        return Collections.EMPTY_SET;
    }

Replace Generic With Diamond Iterator<Pair<Comparable<?>,?>> with Iterator<> in method public entries() : Iterable<? extends Pair<Comparable<?>,?>> from class org.dizitart.no2.index.IndexMap


    private RecordStream<Pair<K, V>> getStream(RecordStream<Pair<K, V>> primaryStream,
                                               RecordStream<Pair<K, V>> backingStream) {
        if (cleared) {
            return RecordStream.empty();
        }

        return () -> new Iterator<>() {
            private final Iterator<Pair<K, V>> primaryIterator = primaryStream.iterator();
            private final Iterator<Pair<K, V>> iterator = backingStream.iterator();
            private Pair<K, V> nextPair;
            private boolean nextPairSet = false;

            @Override
            public boolean hasNext() {
                return nextPairSet || setNextId();
            }

            @Override
            public Pair<K, V> next() {
                if (!nextPairSet && !setNextId()) {
                    throw new NoSuchElementException();
                }
                nextPairSet = false;
                return nextPair;
            }

            private boolean setNextId() {
                if (iterator.hasNext()) {
                    nextPair = iterator.next();
                    nextPairSet = true;
                    return true;
                }

                while (primaryIterator.hasNext()) {
                    final Pair<K, V> pair = primaryIterator.next();
                    if (!tombstones.contains(pair.getFirst())) {
                        nextPair = pair;
                        nextPairSet = true;
                        return true;
                    }
                }

                return false;
            }
        };
    }

    private RecordStream<Pair<K, V>> getStream(RecordStream<Pair<K, V>> primaryStream,
                                               RecordStream<Pair<K, V>> backingStream) {
        if (cleared) {
            return RecordStream.empty();
        }

        return () -> new Iterator<Pair<K, V>>() {
            private final Iterator<Pair<K, V>> primaryIterator = primaryStream.iterator();
            private final Iterator<Pair<K, V>> iterator = backingStream.iterator();
            private Pair<K, V> nextPair;
            private boolean nextPairSet = false;

            @Override
            public boolean hasNext() {
                return nextPairSet || setNextId();
            }

            @Override
            public Pair<K, V> next() {
                if (!nextPairSet && !setNextId()) {
                    throw new NoSuchElementException();
                }
                nextPairSet = false;
                return nextPair;
            }

            private boolean setNextId() {
                if (iterator.hasNext()) {
                    nextPair = iterator.next();
                    nextPairSet = true;
                    return true;
                }

                while (primaryIterator.hasNext()) {
                    final Pair<K, V> pair = primaryIterator.next();
                    if (!tombstones.contains(pair.getFirst())) {
                        nextPair = pair;
                        nextPairSet = true;
                        return true;
                    }
                }

                return false;
            }
        };
    }

Replace Generic With Diamond Iterator<Pair<K,V>> with Iterator<> in method private getStream(primaryStream RecordStream<Pair<K,V>>, backingStream RecordStream<Pair<K,V>>) : RecordStream<Pair<K,V>> from class org.dizitart.no2.transaction.TransactionalMap


    /**
     * Serialize the object to a byte array.
     *
     * @param obj the object to serialize
     * @return the byte array
     */
    public static byte[] serialize(Object obj) {
        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
            try (ObjectOutputStream os = new ObjectOutputStream(out)) {
                os.writeObject(obj);
                return out.toByteArray();
            }
        } catch (Throwable e) {
            throw DataUtils.newIllegalArgumentException(
                "Could not serialize {0}", obj, e);
        }
    }

    /**
     * Serialize the object to a byte array.
     *
     * @param obj the object to serialize
     * @return the byte array
     */
    public static byte[] serialize(Object obj) {
        try {
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            ObjectOutputStream os = new ObjectOutputStream(out);
            os.writeObject(obj);
            return out.toByteArray();
        } catch (Throwable e) {
            throw DataUtils.newIllegalArgumentException(
                "Could not serialize {0}", obj, e);
        }
    }

Try With Resources try(ObjectOutputStream os=new ObjectOutputStream(out)) in method public serialize(obj Object) : byte[] from class org.dizitart.no2.mvstore.compat.v3.NitriteDataType


    @Test
    public void testSetNitriteIds() {
        WriteResultImpl writeResultImpl = new WriteResultImpl();
        writeResultImpl.setNitriteIds(new HashSet<>());
        assertEquals("WriteResultImpl(nitriteIds=[])", writeResultImpl.toString());
    }

    @Test
    public void testSetNitriteIds() {
        WriteResultImpl writeResultImpl = new WriteResultImpl();
        writeResultImpl.setNitriteIds(new HashSet<NitriteId>());
        assertEquals("WriteResultImpl(nitriteIds=[])", writeResultImpl.toString());
    }

Replace Generic With Diamond HashSet<NitriteId> with HashSet<> in method public testSetNitriteIds() : void from class org.dizitart.no2.collection.operation.WriteResultImplTest


    @Test
    public void testAddToList2() {
        WriteResultImpl writeResultImpl = new WriteResultImpl();
        writeResultImpl.setNitriteIds(new HashSet<>());
        writeResultImpl.addToList(NitriteId.newId());
        assertEquals(1, writeResultImpl.getAffectedCount());
    }

    @Test
    public void testAddToList2() {
        WriteResultImpl writeResultImpl = new WriteResultImpl();
        writeResultImpl.setNitriteIds(new HashSet<NitriteId>());
        writeResultImpl.addToList(NitriteId.newId());
        assertEquals(1, writeResultImpl.getAffectedCount());
    }

Replace Generic With Diamond HashSet<NitriteId> with HashSet<> in method public testAddToList2() : void from class org.dizitart.no2.collection.operation.WriteResultImplTest


    @Test
    public void testApply() {
        EqualsFilter equalsFilter = new EqualsFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<>();
        pair.setSecond(Document.createDocument());
        assertFalse(equalsFilter.apply(pair));
        assertTrue(equalsFilter.getValue() instanceof String);
    }

    @Test
    public void testApply() {
        EqualsFilter equalsFilter = new EqualsFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<NitriteId, Document>();
        pair.setSecond(Document.createDocument());
        assertFalse(equalsFilter.apply(pair));
        assertTrue(equalsFilter.getValue() instanceof String);
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply() : void from class org.dizitart.no2.filters.EqualsFilterTest


    @Test
    public void testApply2() {
        EqualsFilter equalsFilter = new EqualsFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertFalse(equalsFilter.apply(new Pair<>(first, Document.createDocument())));
        assertTrue(equalsFilter.getValue() instanceof String);
    }

    @Test
    public void testApply2() {
        EqualsFilter equalsFilter = new EqualsFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertFalse(equalsFilter.apply(new Pair<NitriteId, Document>(first, Document.createDocument())));
        assertTrue(equalsFilter.getValue() instanceof String);
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply2() : void from class org.dizitart.no2.filters.EqualsFilterTest


    @Test
    public void testApply() {
        RegexFilter regexFilter = new RegexFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<>();
        pair.setSecond(Document.createDocument());
        assertFalse(regexFilter.apply(pair));
    }

    @Test
    public void testApply() {
        RegexFilter regexFilter = new RegexFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<NitriteId, Document>();
        pair.setSecond(Document.createDocument());
        assertFalse(regexFilter.apply(pair));
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply() : void from class org.dizitart.no2.filters.RegexFilterTest


    @Test
    public void testApply2() {
        RegexFilter regexFilter = new RegexFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertFalse(regexFilter.apply(new Pair<>(first, Document.createDocument())));
    }

    @Test
    public void testApply2() {
        RegexFilter regexFilter = new RegexFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertFalse(regexFilter.apply(new Pair<NitriteId, Document>(first, Document.createDocument())));
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply2() : void from class org.dizitart.no2.filters.RegexFilterTest


    @Test
    public void testGet() {
        assertNull((new InMemoryMap<>("Map Name", null)).get("Key"));
    }

    @Test
    public void testGet() {
        assertNull((new InMemoryMap<Object, Object>("mapName", null)).get("key"));
    }

Replace Generic With Diamond InMemoryMap<Object,Object> with InMemoryMap<> in method public testGet() : void from class org.dizitart.no2.store.memory.InMemoryMapTest


    @Test
    public void testValues() {
        assertTrue((new InMemoryMap<>("Map Name", null)).values().toList().isEmpty());
    }

    @Test
    public void testValues() {
        assertTrue((new InMemoryMap<Object, Object>("mapName", null)).values().isEmpty());
    }

Replace Generic With Diamond InMemoryMap<Object,Object> with InMemoryMap<> in method public testValues() : void from class org.dizitart.no2.store.memory.InMemoryMapTest


    @Test
    public void testSize() {
        assertEquals(0L, (new InMemoryMap<>("Map Name", null)).size());
    }

    @Test
    public void testSize() {
        assertEquals(0L, (new InMemoryMap<Object, Object>("mapName", null)).size());
    }

Replace Generic With Diamond InMemoryMap<Object,Object> with InMemoryMap<> in method public testSize() : void from class org.dizitart.no2.store.memory.InMemoryMapTest


    @Test
    public void testEntries() {
        assertTrue((new InMemoryMap<>("Map Name", null)).entries().toList().isEmpty());
    }

    @Test
    public void testEntries() {
        assertTrue((new InMemoryMap<Object, Object>("mapName", null)).entries().isEmpty());
    }

Replace Generic With Diamond InMemoryMap<Object,Object> with InMemoryMap<> in method public testEntries() : void from class org.dizitart.no2.store.memory.InMemoryMapTest


    @Test
    public void testIsEmpty() {
        assertTrue((new InMemoryMap<>("Map Name", null)).isEmpty());
    }

    @Test
    public void testIsEmpty() {
        assertTrue((new InMemoryMap<Object, Object>("mapName", null)).isEmpty());
    }

Replace Generic With Diamond InMemoryMap<Object,Object> with InMemoryMap<> in method public testIsEmpty() : void from class org.dizitart.no2.store.memory.InMemoryMapTest


    @Test
    public void testFindIdSet2() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", 42);
        notEqualsFilter.setOnIdField(true);
        assertEquals(0, notEqualsFilter.findIdSet(new InMemoryMap<>("mapName", null)).size());
        assertTrue(notEqualsFilter.getValue() instanceof Integer);
    }

    @Test
    public void testFindIdSet2() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", 42);
        notEqualsFilter.setOnIdField(true);
        assertEquals(0, notEqualsFilter.findIdSet(new InMemoryMap<NitriteId, Document>("mapName", null)).size());
        assertTrue(notEqualsFilter.getValue() instanceof Integer);
    }

Replace Generic With Diamond InMemoryMap<NitriteId,Document> with InMemoryMap<> in method public testFindIdSet2() : void from class org.dizitart.no2.filters.NotEqualsFilterTest


    @Test
    public void testApply() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertTrue(notEqualsFilter.apply(new Pair<>(first, Document.createDocument())));
        assertTrue(notEqualsFilter.getValue() instanceof String);
    }

    @Test
    public void testApply() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", "value");
        NitriteId first = NitriteId.newId();
        assertTrue(notEqualsFilter.apply(new Pair<NitriteId, Document>(first, Document.createDocument())));
        assertTrue(notEqualsFilter.getValue() instanceof String);
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply() : void from class org.dizitart.no2.filters.NotEqualsFilterTest


    @Test
    public void testApply2() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<>();
        pair.setSecond(Document.createDocument());
        assertTrue(notEqualsFilter.apply(pair));
        assertTrue(notEqualsFilter.getValue() instanceof String);
    }

    @Test
    public void testApply2() {
        NotEqualsFilter notEqualsFilter = new NotEqualsFilter("field", "value");
        Pair<NitriteId, Document> pair = new Pair<NitriteId, Document>();
        pair.setSecond(Document.createDocument());
        assertTrue(notEqualsFilter.apply(pair));
        assertTrue(notEqualsFilter.getValue() instanceof String);
    }

Replace Generic With Diamond Pair<NitriteId,Document> with Pair<> in method public testApply2() : void from class org.dizitart.no2.filters.NotEqualsFilterTest


    @Test
    public void testCanEqual() {
        assertFalse((new Pair<>()).canEqual("other"));
    }

    @Test
    public void testCanEqual() {
        assertFalse((new Pair<Object, Object>()).canEqual("other"));
    }

Replace Generic With Diamond Pair<Object,Object> with Pair<> in method public testCanEqual() : void from class org.dizitart.no2.common.tuples.PairTest