    @Override
    public ExecuteResponse handleUpdate(ExecuteRequest request, GigaSpaceUpdateSql updateSql) {
        SQLQuery query = new SQLQuery<>(updateSql.typeName, updateSql.conditions);
        ChangeSet changeSet = new ChangeSet();

        for (Map.Entry<String, Object> field : updateSql.setFields.entrySet()) {
            changeSet.set(field.getKey(), (Serializable) field.getValue());
        }

        ChangeResult changeResult = gigaSpaceConnection(request).change(query, changeSet);
        ExecuteResponse executeResponse = new ExecuteResponse();
        executeResponse.columns = Arrays.asList("affected_rows");
        executeResponse.data = Arrays.asList(Arrays.asList(Integer.toString(changeResult.getNumberOfChangedEntries())));
        return executeResponse;
    }

    @Override
    public ExecuteResponse handleUpdate(ExecuteRequest request, GigaSpaceUpdateSql updateSql) {
        SQLQuery query = new SQLQuery<SpaceDocument>(updateSql.typeName, updateSql.conditions);
        ChangeSet changeSet = new ChangeSet();

        for (Map.Entry<String, Object> field : updateSql.setFields.entrySet()) {
            changeSet.set(field.getKey(), (Serializable) field.getValue());
        }

        ChangeResult changeResult = gigaSpaceConnection(request).change(query, changeSet);
        ExecuteResponse executeResponse = new ExecuteResponse();
        executeResponse.columns = Arrays.asList("affected_rows");
        executeResponse.data = Arrays.asList(Arrays.asList(Integer.toString(changeResult.getNumberOfChangedEntries())));
        return executeResponse;
    }

Replace Generic With Diamond SQLQuery<SpaceDocument> with SQLQuery<> in method public handleUpdate(request ExecuteRequest, updateSql GigaSpaceUpdateSql) : ExecuteResponse from class com.github.terma.gigaspacesqlconsole.provider.ExecutorProviderImpl


    /**
     * Test with French contraction of 'à le' into 'au'.
     */
    @Test
    public void frenchContractionALeTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "noun-contraction-ale"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Aller au salon.");
    }

    /**
     * Test with French contraction of 'à le' into 'au'.
     */
    @Test
    public void frenchContractionALeTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "noun-contraction-ale"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Aller au salon.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public frenchContractionALeTest() : void from class NounFeatureTest


    /**
     * Test with French contraction of 'de le' into 'du'.
     */
    @Test
    public void frenchContractionDeLeTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "noun-contraction-dele"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "En direction du salon.");
    }

    /**
     * Test with French contraction of 'de le' into 'du'.
     */
    @Test
    public void frenchContractionDeLeTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "noun-contraction-dele"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "En direction du salon.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public frenchContractionDeLeTest() : void from class NounFeatureTest


    /**
     * Test with French contraction of 'à le' into 'au' while using a plain $variable instead of grammatical block.
     */
    @Test
    public void frenchContractionVariableTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "noun-contraction-variable"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Aller au salon.");
    }

    /**
     * Test with French contraction of 'à le' into 'au' while using a plain $variable instead of grammatical block.
     */
    @Test
    public void frenchContractionVariableTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "noun-contraction-variable"));
        arguments.add(new ERArgument("location", "salon"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Aller au salon.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public frenchContractionVariableTest() : void from class NounFeatureTest


    /**
     * Test with French elision.
     */
    @Test
    public void frenchElisionTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "noun-elision"));
        arguments.add(new ERArgument("task", "goSomewhere"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Ca te dirait d'aller?");
    }

    /**
     * Test with French elision.
     */
    @Test
    public void frenchElisionTest() {
        context.clearArguments();
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "noun-elision"));
        arguments.add(new ERArgument("task", "goSomewhere"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        testFrenchPredicate(predicate, context, "Ca te dirait d'aller?");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public frenchElisionTest() : void from class NounFeatureTest


    /**
     * Test where both the speaker and the listener are mentioned in the predicate.
     */
    @Test
    public void genderBothMentionedTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "pronoun-gender"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "I am your best friend.");
        testFrenchPredicate(predicate, context, "Je suis ta meilleure amie.");
        testDutchPredicate(predicate, context, "Ik ben jouw beste vriendin.");
    }

    /**
     * Test where both the speaker and the listener are mentioned in the predicate.
     */
    @Test
    public void genderBothMentionedTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "pronoun-gender"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "I am your best friend.");
        testFrenchPredicate(predicate, context, "Je suis ta meilleure amie.");
        testDutchPredicate(predicate, context, "Ik ben jouw beste vriendin.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public genderBothMentionedTest() : void from class PronounTest


    /**
     * Test with a reflexive verb that needs the proper pronoun based on gender and number.
     */
    @Test
    public void reflexiveVerbPronounTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "pronoun-reflexiveverb"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "I amuse myself.");
        testFrenchPredicate(predicate, context, "Je m'amuse.");
        testDutchPredicate(predicate, context, "Ik amuseer me.");
    }

    /**
     * Test with a reflexive verb that needs the proper pronoun based on gender and number.
     */
    @Test
    public void reflexiveVerbPronounTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "pronoun-reflexiveverb"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "I amuse myself.");
        testFrenchPredicate(predicate, context, "Je m'amuse.");
        testDutchPredicate(predicate, context, "Ik amuseer me.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public reflexiveVerbPronounTest() : void from class PronounTest


    /**
     * Test with a reflexive verb that needs the proper pronoun based on gender and number.
     */
    @Test
    public void reflexiveVerbPronounSecondPersonTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "pronoun-reflexiveverb"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(frank);
        context.setListener(julia);

        testEnglishPredicate(predicate, context, "You amuse yourself.");
        testFrenchPredicate(predicate, context, "Tu t'amuses.");
        testDutchPredicate(predicate, context, "Jij amuseert je.");
    }

    /**
     * Test with a reflexive verb that needs the proper pronoun based on gender and number.
     */
    @Test
    public void reflexiveVerbPronounSecondPersonTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "pronoun-reflexiveverb"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(frank);
        context.setListener(julia);

        testEnglishPredicate(predicate, context, "You amuse yourself.");
        testFrenchPredicate(predicate, context, "Tu t'amuses.");
        testDutchPredicate(predicate, context, "Jij amuseert je.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public reflexiveVerbPronounSecondPersonTest() : void from class PronounTest


    /**
     * Test with a simple repeating referent.
     */
    @Test
    public void refExpSimpleRepetitionTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-simplerepetition"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "Paul needs medicine. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. Hij neemt de medicijnen.");
    }

    /**
     * Test with a simple repeating referent.
     */
    @Test
    public void refExpSimpleRepetitionTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-simplerepetition"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "Paul needs medicine. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. Hij neemt de medicijnen.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpSimpleRepetitionTest() : void from class PronounTest


    /**
     * Test where a referent is mentioned again after a long distance.
     */
    @Test
    public void refExpLongDistanceTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-longdistance"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "Paul needs medicine. The medicine is in the drawer. "
                + "The drawer is closed. Paul opens the drawer. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Les médicaments sons dans le tiroir. "
                + "Le tiroir est fermé. Paul ouvre le tiroir. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. De medicijnen liggen in de la. "
                + "De la is gesloten. Paul opent de la. Hij neemt de medicijnen.");
    }

    /**
     * Test where a referent is mentioned again after a long distance.
     */
    @Test
    public void refExpLongDistanceTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-longdistance"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        testEnglishPredicate(predicate, context, "Paul needs medicine. The medicine is in the drawer. "
                + "The drawer is closed. Paul opens the drawer. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Les médicaments sons dans le tiroir. "
                + "Le tiroir est fermé. Paul ouvre le tiroir. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. De medicijnen liggen in de la. "
                + "De la is gesloten. Paul opent de la. Hij neemt de medicijnen.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpLongDistanceTest() : void from class PronounTest


    /**
     * Test with a subject that has an owner. The subject is also repeated.
     * Note: the repetition is chosen to be replaced with a pronoun, even though "her drawer" instead of "it" would
     * also be possible.
     */
    @Test
    public void refExpLongDistanceOwnerTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-longdistanceowner"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        // Note: 'drawer' is not in the lexicon. To generate 'it', the test source uses the .n feature to set the proper gender.
        testEnglishPredicate(predicate, context, "Paul needs medicine. The medicine is in Lili's drawer. "
                + "It is closed. Paul opens the drawer. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Les médicaments sons dans le tiroir de Lili. "
                + "Il est fermé. Paul ouvre le tiroir. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. De medicijnen liggen in Lili's la. "
                + "Hij is gesloten. Paul opent de la. Hij neemt de medicijnen.");
    }

    /**
     * Test with a subject that has an owner. The subject is also repeated.
     * Note: the repetition is chosen to be replaced with a pronoun, even though "her drawer" instead of "it" would
     * also be possible.
     */
    @Test
    public void refExpLongDistanceOwnerTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-longdistanceowner"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(frank);

        // Note: 'drawer' is not in the lexicon. To generate 'it', the test source uses the .n feature to set the proper gender.
        testEnglishPredicate(predicate, context, "Paul needs medicine. The medicine is in Lili's drawer. "
                + "It is closed. Paul opens the drawer. He takes the medicine.");
        testFrenchPredicate(predicate, context, "Paul a besoin de médicaments. Les médicaments sons dans le tiroir de Lili. "
                + "Il est fermé. Paul ouvre le tiroir. Il prend les médicaments.");
        testDutchPredicate(predicate, context, "Paul heeft medicijnen nodig. De medicijnen liggen in Lili's la. "
                + "Hij is gesloten. Paul opent de la. Hij neemt de medicijnen.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpLongDistanceOwnerTest() : void from class PronounTest


    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-ambiguity"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank greeted Pete. Pete smiled.");
        testFrenchPredicate(predicate, context, "Frank a salué Pierre. Pierre a souri.");
        testDutchPredicate(predicate, context, "Frank begroette Pieter. Pieter glimlachte.");
    }

    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-ambiguity"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank greeted Pete. Pete smiled.");
        testFrenchPredicate(predicate, context, "Frank a salué Pierre. Pierre a souri.");
        testDutchPredicate(predicate, context, "Frank begroette Pieter. Pieter glimlachte.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpAmbiguityTest() : void from class PronounTest


    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityOwnerTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-ambiguityowner"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank's dog greeted Pete's dog. Pete's dog barked.");
        testFrenchPredicate(predicate, context, "Le chien de Frank a salué le chien de Pierre. Le chien de Pierre a aboyé.");
        testDutchPredicate(predicate, context, "Frank's hond begroette Pieter's hond. Pieter's hond blafte.");
    }

    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityOwnerTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-ambiguityowner"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank's dog greeted Pete's dog. Pete's dog barked.");
        testFrenchPredicate(predicate, context, "Le chien de Frank a salué le chien de Pierre. Le chien de Pierre a aboyé.");
        testDutchPredicate(predicate, context, "Frank's hond begroette Pieter's hond. Pieter's hond blafte.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpAmbiguityOwnerTest() : void from class PronounTest


    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityOwnerFeatureTest() {
        Vector<ERArgument> arguments = new Vector<>();
        arguments.add(new ERArgument("test", "refexp-ambiguityownerfeature"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank's dog greeted Pete's dog. Pete's dog barked.");
        testFrenchPredicate(predicate, context, "La chienne de Frank a salué la chienne de Pierre. La chienne de Pierre a aboyé.");
        testDutchPredicate(predicate, context, "Frank's hond begroette Pieter's hond. Pieter's hond blafte.");
    }

    /**
     * Test with two similar entities (both male), one of which is repeated.
     */
    @Test
    public void refExpAmbiguityOwnerFeatureTest() {
        Vector<ERArgument> arguments = new Vector<ERArgument>();
        arguments.add(new ERArgument("test", "refexp-ambiguityownerfeature"));
        ERPredicate predicate = new ERPredicate("InformIntention", arguments);

        context.setSpeaker(julia);
        context.setListener(lili);

        testEnglishPredicate(predicate, context, "Frank's dog greeted Pete's dog. Pete's dog barked.");
        testFrenchPredicate(predicate, context, "La chienne de Frank a salué la chienne de Pierre. La chienne de Pierre a aboyé.");
        testDutchPredicate(predicate, context, "Frank's hond begroette Pieter's hond. Pieter's hond blafte.");
    }

Replace Generic With Diamond Vector<ERArgument> with Vector<> in method public refExpAmbiguityOwnerFeatureTest() : void from class PronounTest


    public Iterator<Object []> readFromCSV() {
        String[] data;
        List<Object []> testCases = new ArrayList<>();
        BufferedReader br = null;
        String line ;

        try  (InputStream input = Files.newInputStream(Path.of("src/main/resources/test-data/testdata.csv"))){
            br = new BufferedReader(new FileReader("src/main/resources/test-data/testdata.csv"));
            while ((line = br.readLine()) != null) {
                data = line.split(DELIMITER);
                testCases.add(data);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return testCases.iterator();
    }

    public Iterator<Object []> readFromCSV() {
        String[] data;
        List<Object []> testCases = new ArrayList<>();
        BufferedReader br = null;
        String line ;

        try {
            br = new BufferedReader(new FileReader("src/main/resources/test-data/testdata.csv"));
            while ((line = br.readLine()) != null) {
                data = line.split(DELIMITER);
                testCases.add(data);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return testCases.iterator();
    }

Try With Resources try(InputStream input=Files.newInputStream(Path.of("src/main/resources/test-data/testdata.csv"))) in method public readFromCSV() : Iterator<Object[]> from class pageobject_model.service.TestDataProvider


    public static ExpectedCondition<Boolean> jQueryAJAXsCompleted(){
        return new ExpectedCondition<>() {
            @Override
            public Boolean apply(WebDriver driver) {
                return (Boolean) ((JavascriptExecutor) driver).executeScript("return(window.jQuery!=null) && (JQUERY.ACTIVE== = 0);");
            }
        };
    }

    public static ExpectedCondition<Boolean> jQueryAJAXsCompleted(){
        return new ExpectedCondition<Boolean>() {
            @Override
            public Boolean apply(WebDriver driver) {
                return (Boolean) ((JavascriptExecutor)driver).executeScript("return(window.jQuery!=null) && (JQUESRY.ACTIVE== = 0);");
            }
        };
    }

Replace Generic With Diamond ExpectedCondition<Boolean> with ExpectedCondition<> in method public jQueryAJAXsCompleted() : ExpectedCondition<Boolean> from class pageobject_model.page.CustomConditions


  public static synchronized PropertiesLoader getInstance() {
    if (instance == null) {
      instance = new PropertiesLoader();
      properties = new Properties();
      try (FileInputStream is = new FileInputStream(RESOURCE_FILE_NAME)) {
        properties.load(is);
      } catch (FileNotFoundException e) {
      } catch (IOException e) {
        System.out.println(e);
      }
    }
    return instance;
  }

  public static synchronized PropertiesLoader getInstance() {
    if (instance == null) {
      instance = new PropertiesLoader();
      properties = new Properties();
      FileInputStream is = null;
      try {
        is = new FileInputStream(RESOURCE_FILE_NAME);
        properties.load(is);
      } catch (FileNotFoundException e) {
      } catch (IOException e) {
        System.out.println(e);
      } finally {
        if (null != is) {
          try {
            is.close();
          } catch (IOException e) {
          }
        }
      }
    }
    return instance;
  }

Try With Resources try(FileInputStream is=new FileInputStream(RESOURCE_FILE_NAME)) in method public getInstance() : PropertiesLoader from class ee.playtech.wallet.program.PropertiesLoader


    @Override
    public void run() {
      try (ObjectOutputStream out = new ObjectOutputStream(clientSocket.getOutputStream())) {
        out.flush();
        try (ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream())) {
          do {
            try {
              message = (WalletRequest) in.readObject();
              out.writeObject(service.getWalletResponse(message));
              out.flush();
            } catch (ClassNotFoundException e) {
              log.error(e.getMessage(), e);
            }
          } while (true);
        }
      } catch (EOFException e) {
      } catch (IOException e) {
        log.error(e.getMessage(), e);
      }
    }

    @Override
    public void run() {
      try {
        out = new ObjectOutputStream(clientSocket.getOutputStream());
        out.flush();
        try (ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream())) {
          do {
            try {
              message = (WalletRequest) in.readObject();
              log.info("Server received: " + message);
              sendMessage(new WalletResponse(message));
            } catch (ClassNotFoundException e) {
              System.out.println("Data received in unknown format: " + e);
            }
          } while (true);
        }
      } catch (EOFException e) {
      } catch (IOException e) {
        System.out.println(e);
      } finally {
        try {
          out.close();
        } catch (IOException e) {
          System.out.println(e);
        }
      }
    }

Try With Resources try(ObjectOutputStream out=new ObjectOutputStream(clientSocket.getOutputStream())) in method public run() : void from class socket.server.Server.ServerThread


  public void start() {
    try (Socket socket = new Socket(host, port)) {
      try {
        socket.setSoTimeout(3000);
      } catch (Exception e) {
        System.out.println("Please check is server running on host: " + host + ", port: " + port);
        return;
      }
      try (ObjectOutputStream out = new ObjectOutputStream(socket.getOutputStream())) {
        out.flush();
        try (ObjectInputStream in = new ObjectInputStream(socket.getInputStream())) {
          // send
          out.writeObject(message);
          out.flush();
          log.info("Client sended: " + message);

          // receive
          response = (WalletResponse) in.readObject();
          log.info("Client received: " + response);

        } catch (ClassNotFoundException e) {
          System.out.println(e);
        }
      }
    } catch (UnknownHostException e) {
    } catch (IOException e) {
      System.out.println(e);
    }
  }

  protected void start() {
    try {
      try {
        socket = new Socket(host, port);
        socket.setSoTimeout(3000);
      } catch (Exception e) {
        System.out.println("Please check is server running on host: " + host + ", port: " + port);
        return;
      }
      out = new ObjectOutputStream(socket.getOutputStream());
      out.flush();
      in = new ObjectInputStream(socket.getInputStream());
      try {
        // send
        out.writeObject(message);
        out.flush();
        // receive
        response = (String) in.readObject();
      } catch (IOException e) {
        System.out.println(e);
      } catch (ClassNotFoundException e) {
        System.out.println(e);
      }
    } catch (UnknownHostException e) {
    } catch (IOException e) {
      System.out.println(e);
    } finally {
      try {
        if (in != null) {
          in.close();
        }
      } catch (IOException e) {
      }
      try {
        out.close();
      } catch (IOException e) {
      }
      try {
        socket.close();
      } catch (IOException e) {
      }
    }
  }

Try With Resources try(ObjectOutputStream out=new ObjectOutputStream(socket.getOutputStream())) in method public start() : void from class socket.client.Client


    @Override
    public void run() {
      try {
        out = new ObjectOutputStream(clientSocket.getOutputStream());
        out.flush();
        try (ObjectInputStream in = new ObjectInputStream(clientSocket.getInputStream())) {
          do {
            try {
              message = (WalletRequest) in.readObject();
              log.info("Server received: " + message);
              sendMessage(new WalletResponse(message));
            } catch (ClassNotFoundException e) {
              System.out.println("Data received in unknown format: " + e);
            }
          } while (true);
        }
      } catch (EOFException e) {
      } catch (IOException e) {
        System.out.println(e);
      } finally {
        try {
          out.close();
        } catch (IOException e) {
          System.out.println(e);
        }
      }
    }

    @Override
    public void run() {
      try {
        out = new ObjectOutputStream(clientSocket.getOutputStream());
        out.flush();
        in = new ObjectInputStream(clientSocket.getInputStream());
        do {
          try {
            message = (String) in.readObject();
            long recNo = Long.parseLong(message.split(TERMINATOR)[1]);
            sendMessage("one of test message");
          } catch (ClassNotFoundException e) {
            System.out.println("Data received in unknown format: " + e);
          }
        } while (true);
      } catch (EOFException e) {
      } catch (IOException e) {
        System.out.println(e);
      } finally {
        try {
          in.close();
        } catch (IOException e) {
          System.out.println(e);
        }
        try {
          out.close();
        } catch (IOException e) {
          System.out.println(e);
        }
      }
    }

Try With Resources try(ObjectInputStream in=new ObjectInputStream(clientSocket.getInputStream())) in method public run() : void from class socket.server.Server.ServerThread


    @Override
    public void runProgram(Program p, Consumer<Result> result) {
        Thread t = new Thread(() -> result.accept(runProgram(p)));
        t.start();
    }

    @Override
    public void runProgram(Program p, Consumer<Result> result) {
        Thread t = new Thread() {
            @Override
            public void run() {
                result.accept(runProgram(p));
            }
        };
        t.start();
    }

Replace Anonymous With Lambda com.gluonhq.strange.local.SimpleQuantumExecutionEnvironment.runProgram.t.new Thread with () -> result.accept(runProgram(p)) in method public runProgram(p Program, result Consumer<Result>) : void from class com.gluonhq.strange.local.SimpleQuantumExecutionEnvironment


    private ArrayList<Entity> calculateSubstations(int height, int width, int substationOffsetX, int substationOffsetY) {
        return new ArrayList<>() {{
            for (int subX = substationOffsetX + width; subX > -9; subX -= 18)
                for (int subY = substationOffsetY + height; subY > -9; subY -= 18) {
                    Entity substation = buildSubstation(subX, subY, width, height, substationOffsetX, substationOffsetY);
                    add(substation);
                    //remove lights
                    if (subX <= width && subY <= height) {
                        if (subX < width) if (subX >= 0 && subY >= 0) {
                            arrangement[subY][subX] = null;
                            if (subY - 1 >= 0) arrangement[subY - 1][subX] = null;
                        }
                        if (subX - 1 >= 0 && subY >= 0) {
                            arrangement[subY][subX - 1] = null;
                            if (subY - 1 >= 0) arrangement[subY - 1][subX - 1] = null;
                        }
                    }
                }
        }};
    }

    private ArrayList<Entity> calculateSubstations(Integer[][] arrangement,int height, int width,int substationOffsetX, int substationOffsetY) {
        return new ArrayList<Entity>() {{
            for (int subX = substationOffsetX + width; subX > -9; subX -= 18) {
                for (int subY = substationOffsetY + height; subY > -9; subY -= 18) {
                    Entity substation = new Entity(
                            "substation",
                            new Position(-width + subX * 1F, -height + subY * 1F)
                    );
                    // neighbouring substations
                    ArrayList<Integer> neighbours = new ArrayList<>();
                    if (subY > 9) neighbours.add(Entity.getEntityCount() + 1);
                    if (subY != substationOffsetY + height) neighbours.add(Entity.getEntityCount() - 1);
                    else {
                        if (subX > 9)
                            neighbours.add((int) (Entity.getEntityCount() + Math.ceil((substationOffsetY + height + 9) / 18.0)));
                        if (subX != substationOffsetX + width)
                            neighbours.add((int) (Entity.getEntityCount() - Math.ceil((substationOffsetX + width + 9) / 18.0)));
                    }
                    substation.setNeighbours(neighbours);
                    add(substation);
                    //remove lights
                    if (subX <= width && subY <= height) {
                        if (subX < width) {
                            if (subX >= 0 && subY >= 0) {
                                arrangement[subY][subX] = null;
                                if (subY - 1 >= 0) arrangement[subY - 1][subX] = null;
                            }
                        }
                        if (subX - 1 >= 0 && subY >= 0) {
                            arrangement[subY][subX - 1] = null;
                            if (subY - 1 >= 0) arrangement[subY - 1][subX - 1] = null;
                        }
                    }
                }
            }
        }};
    }

Replace Generic With Diamond ArrayList<Entity> with ArrayList<> in method private calculateSubstations(height int, width int, substationOffsetX int, substationOffsetY int) : ArrayList<Entity> from class factorio.calculator.FactorioCalculator


    private ArrayList<Entity> calculateSubstations() {
        return new ArrayList<>() {{
            for (int subX = substationOffsetX.getValue() + width; subX > -9; subX -= 18)
                for (int subY = substationOffsetY.getValue() + height; subY > -9; subY -= 18) {
                    Entity substation = buildSubstation(subX, subY);
                    add(substation);
                    //remove lights
                    if (subX <= width && subY <= height) {
                        if (subX < width) {
                            if (subX >= 0 && subY >= 0) {
                                arrangement[subY][subX] = null;
                                if (subY - 1 >= 0) arrangement[subY - 1][subX] = null;
                            }
                        }
                        if (subX - 1 >= 0 && subY >= 0) {
                            arrangement[subY][subX - 1] = null;
                            if (subY - 1 >= 0) arrangement[subY - 1][subX - 1] = null;
                        }
                    }
                }
        }};
    }

    private ArrayList<Entity> calculateSubstations() {
        return new ArrayList<Entity>() {{
            for (int subX = substationOffsetX.getValue() + width; subX > -9; subX -= 18) {
                for (int subY = substationOffsetY.getValue() + height; subY > -9; subY -= 18) {
                    Entity substation = new Entity(
                            "substation",
                            new Position(-width + subX * 1F, -height + subY * 1F)
                    );
                    // neighbouring substations
                    ArrayList<Integer> neighbours = new ArrayList<>();
                    if (subY > 9) neighbours.add(Entity.getEntityCount() + 1);
                    if (subY != substationOffsetY.getValue() + height) neighbours.add(Entity.getEntityCount() - 1);
                    else {
                        if (subX > 9)
                            neighbours.add((int) (Entity.getEntityCount() + Math.ceil((substationOffsetY.getValue() + height + 9) / 18.0)));
                        if (subX != substationOffsetX.getValue() + width)
                            neighbours.add((int) (Entity.getEntityCount() - Math.ceil((substationOffsetX.getValue() + width + 9) / 18.0)));
                    }
                    substation.setNeighbours(neighbours);
                    add(substation);
                    //remove lights
                    if (subX <= width && subY <= height) {
                        if (subX < width) {
                            if (subX >= 0 && subY >= 0) {
                                arrangement[subY][subX] = null;
                                if (subY - 1 >= 0) arrangement[subY - 1][subX] = null;
                            }
                        }
                        if (subX - 1 >= 0 && subY >= 0) {
                            arrangement[subY][subX - 1] = null;
                            if (subY - 1 >= 0) arrangement[subY - 1][subX - 1] = null;
                        }
                    }
                }
            }
        }};
    }

Replace Generic With Diamond ArrayList<Entity> with ArrayList<> in method private calculateSubstations() : ArrayList<Entity> from class factorio.gui.BitGIFGeneratorController


    @FXML
    private void math() {
        //calculate raw values from pixels without optimisation
        int[][] arrangement = new int[height][width];
        if (pictureList != null) {
            for (int imageCount = 0; imageCount < pictureList.size() && imageCount < 32; imageCount++) {
                Image image = new Image(pictureList.get(imageCount).toURI().toString());
                PixelReader pixelReader = image.getPixelReader();
                for (int readY = 0; readY < height; readY++) {
                    for (int readX = 0; readX < width; readX++) {
                        if (readX < image.getWidth() && readY < image.getHeight() && pixelReader.getColor(readX, readY).getBrightness() >= brightness) {
                            arrangement[readY][readX] = setBit(imageCount, arrangement[readY][readX]);
                        }
                    }
                }
            }
        }

        //optimize values into output
        Entity.setEntityCount(0);
        ArrayList<Entity> entities = new ArrayList<>();
        ArrayList<Integer> signalValues = new ArrayList<>();
        for (int row = 0; row < height; row++) {
            for (int column = 0; column < width; column++) {
                CircuitCondition condition = new CircuitCondition();
                if (signalValues.contains(arrangement[row][column])) {
                    condition.setFirstSignal(new SignalID(signalValues.indexOf(arrangement[row][column])));
                } else if (arrangement[row][column] != 0) {
                    signalValues.add(arrangement[row][column]);
                    condition.setFirstSignal(new SignalID(signalValues.size() - 1));
                }
                ArrayList<ConnectionData> connections = new ArrayList<>();
                //connect up
                if (row != 0) connections.add(new ConnectionData(Entity.getEntityCount() - width + 1));
                //connect left
                if (row == height - 1 && column != 0) connections.add(new ConnectionData(Entity.getEntityCount()));
                entities.add(new Entity(
                        "small-lamp",
                        new Position(-width / 2 + column * 1F, -height + row * 1F),
                        null,
                        null,
                        new ControlBehaviour(true, condition),
                        connections.size() > 0 ? new Connection(new ConnectionPoint(null, connections)) : null
                ));
            }
        }
        entities.add(new Entity(
                "constant-combinator",
                new Position(-width / 2 + 2F, 0F),
                4,
                null,
                new ControlBehaviour(new ArrayList<>() {{
                    add(new Filter(new SignalID("signal-black"), 0, 1));
                }}),
                null
        ));
        entities.add(new Entity(
                "arithmetic-combinator",
                new Position(-width / 2 + 0.5F, 0F),
                6,
                null,
                new ControlBehaviour(new ArithmeticCondition(
                        new SignalID("signal-each"),
                        new SignalID("signal-black"),
                        "<<",
                        new SignalID("signal-each")
                )),
                new Connection(
                        new ConnectionPoint(new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount() + 2));
                        }}, new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount()));
                        }}),
                        new ConnectionPoint(null, new ArrayList<>() {{
                            add(new ConnectionData(width * height - width + 1));
                        }})
                )
        ));
        for (int combinator = 0; combinator <= (signalValues.size() - 1) / 20; combinator++) {
            ArrayList<Filter> filters = new ArrayList<>();
            for (int signal = 0; signal < 20 && signal + combinator * 20 < signalValues.size(); signal++) {
                filters.add(new Filter(new SignalID(combinator * 20 + signal), signalValues.get(combinator * 20 + signal), signal + 1));
            }
            entities.add(new Entity(
                    "constant-combinator",
                    new Position(-width / 2 + combinator * 1F, 1F),
                    null,
                    null,
                    new ControlBehaviour(filters),
                    new Connection(
                            new ConnectionPoint(new ArrayList<>() {{
                                add(new ConnectionData(Entity.getEntityCount()));
                            }}, null)
                    )
            ));
        }
        Blueprint blueprint = new Blueprint(
                "FactorioDMM-output",
                entities,
                new Icon[]{new Icon(1, new SignalID("small-lamp"))},
                281479271743489L
        );
        previewTextArea.setFont(Font.font("Comic Sans MS Bold", 9.0));
        previewTextArea.setText(BlueprintStringEncoder.Encode(blueprint));
        previewTextArea.setWrapText(true);
        copyMode = true;
    }

    @FXML
    private void math() {
        //calculate raw values from pixels without optimisation
        int[][] arrangement = new int[height][width];
        if (pictureList != null) {
            for (int imageCount = 0; imageCount < pictureList.size() && imageCount < 32; imageCount++) {
                Image image = new Image(pictureList.get(imageCount).toURI().toString());
                PixelReader pixelReader = image.getPixelReader();
                for (int readY = 0; readY < height; readY++) {
                    for (int readX = 0; readX < width; readX++) {
                        if (readX < image.getWidth() && readY < image.getHeight() && pixelReader.getColor(readX, readY).getBrightness() >= brightness) {
                            arrangement[readY][readX] = setBit(imageCount, arrangement[readY][readX]);
                        }
                    }
                }
            }
        }

        //optimize values into output
        ArrayList<Entity> entities = new ArrayList<>();
        ArrayList<Integer> signalValues = new ArrayList<>();
        for (int row = 0; row < height; row++) {
            for (int column = 0; column < width; column++) {
                CircuitCondition condition = new CircuitCondition();
                if (signalValues.contains(arrangement[row][column])) {
                    condition.setFirstSignal(new SignalID(signalValues.indexOf(arrangement[row][column])));
                } else if (arrangement[row][column] != 0) {
                    signalValues.add(arrangement[row][column]);
                    condition.setFirstSignal(new SignalID(signalValues.size() - 1));
                }
                ArrayList<ConnectionData> connections = new ArrayList<>();
                //connect up
                if (row != 0) connections.add(new ConnectionData(Entity.getEntityCount() - width + 1));
                //connect left
                if (row == height - 1 && column != 0) connections.add(new ConnectionData(Entity.getEntityCount()));
                entities.add(new Entity(
                        "small-lamp",
                        new Position(-width / 2 + column * 1F, -height + row * 1F),
                        null,
                        null,
                        new ControlBehaviour(true, condition),
                        connections.size() > 0 ? new Connection(new ConnectionPoint(null, connections)) : null
                ));
            }
        }
        entities.add(new Entity(
                "constant-combinator",
                new Position(-width / 2 + 2F, 0F),
                4,
                null,
                new ControlBehaviour(new ArrayList<Filter>() {{
                    add(new Filter(new SignalID("signal-black"), 0, 1));
                }}),
                null
        ));
        entities.add(new Entity(
                "arithmetic-combinator",
                new Position(-width / 2 + 0.5F, 0F),
                6,
                null,
                new ControlBehaviour(new ArithmeticCondition(
                        new SignalID("signal-each"),
                        new SignalID("signal-black"),
                        "<<",
                        new SignalID("signal-each")
                )),
                new Connection(
                        new ConnectionPoint(new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount() + 2));
                        }}, new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount()));
                        }}),
                        new ConnectionPoint(null, new ArrayList<>() {{
                            add(new ConnectionData(width * height - width + 1));
                        }})
                )
        ));
        for (int combinator = 0; combinator <= (signalValues.size() - 1) / 20; combinator++) {
            ArrayList<Filter> filters = new ArrayList<>();
            for (int signal = 0; signal < 20 && signal + combinator * 20 < signalValues.size(); signal++) {
                filters.add(new Filter(new SignalID(combinator * 20 + signal), signalValues.get(combinator * 20 + signal), signal + 1));
            }
            entities.add(new Entity(
                    "constant-combinator",
                    new Position(-width / 2 + combinator * 1F, 1F),
                    null,
                    null,
                    new ControlBehaviour(filters),
                    new Connection(
                            new ConnectionPoint(new ArrayList<>() {{
                                add(new ConnectionData(Entity.getEntityCount()));
                            }}, null)
                    )
            ));
        }
        Blueprint blueprint = new Blueprint(
                "FactorioDMM-output",
                entities,
                new Icon[] {new Icon(1, new SignalID("small-lamp"))},
                281479271743489L
        );
        previewTextArea.setFont(Font.font("Comic Sans MS Bold", 9.0));
        previewTextArea.setText(BlueprintStringEncoder.Encode(blueprint));
        previewTextArea.setWrapText(true);
        copyMode = true;
    }

Replace Generic With Diamond Entity with Entity in method private math() : void from class factorio.gui.BitGIFGeneratorController


    @FXML
    private void math() {
        //calculate raw values from pixels without optimisation
        int[][] arrangement = new int[height][width];
        if (pictureList != null) {
            for (int imageCount = 0; imageCount < pictureList.size() && imageCount < 32; imageCount++) {
                Image image = new Image(pictureList.get(imageCount).toURI().toString());
                PixelReader pixelReader = image.getPixelReader();
                for (int readY = 0; readY < height; readY++) {
                    for (int readX = 0; readX < width; readX++) {
                        if (readX < image.getWidth() && readY < image.getHeight() && pixelReader.getColor(readX, readY).getBrightness() >= brightness) {
                            arrangement[readY][readX] = setBit(imageCount, arrangement[readY][readX]);
                        }
                    }
                }
            }
        }

        //optimize values into output
        ArrayList<Entity> entities = new ArrayList<>();
        ArrayList<Integer> signalValues = new ArrayList<>();
        for (int row = 0; row < height; row++) {
            for (int column = 0; column < width; column++) {
                CircuitCondition condition = new CircuitCondition();
                if (signalValues.contains(arrangement[row][column])) {
                    condition.setFirstSignal(new SignalID(signalValues.indexOf(arrangement[row][column])));
                } else if (arrangement[row][column] != 0) {
                    signalValues.add(arrangement[row][column]);
                    condition.setFirstSignal(new SignalID(signalValues.size() - 1));
                }
                ArrayList<ConnectionData> connections = new ArrayList<>();
                //connect up
                if (row != 0) connections.add(new ConnectionData(Entity.getEntityCount() - width + 1));
                //connect left
                if (row == height - 1 && column != 0) connections.add(new ConnectionData(Entity.getEntityCount()));
                entities.add(new Entity(
                        "small-lamp",
                        new Position(-width / 2 + column * 1F, -height + row * 1F),
                        null,
                        null,
                        new ControlBehaviour(true, condition),
                        connections.size() > 0 ? new Connection(new ConnectionPoint(null, connections)) : null
                ));
            }
        }
        entities.add(new Entity(
                "constant-combinator",
                new Position(-width / 2 + 2F, 0F),
                4,
                null,
                new ControlBehaviour(new ArrayList<Filter>() {{
                    add(new Filter(new SignalID("signal-black"), 0, 1));
                }}),
                null
        ));
        entities.add(new Entity(
                "arithmetic-combinator",
                new Position(-width / 2 + 0.5F, 0F),
                6,
                null,
                new ControlBehaviour(new ArithmeticCondition(
                        new SignalID("signal-each"),
                        new SignalID("signal-black"),
                        "<<",
                        new SignalID("signal-each")
                )),
                new Connection(
                        new ConnectionPoint(new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount() + 2));
                        }}, new ArrayList<>() {{
                            add(new ConnectionData(Entity.getEntityCount()));
                        }}),
                        new ConnectionPoint(null, new ArrayList<>() {{
                            add(new ConnectionData(width * height - width + 1));
                        }})
                )
        ));
        for (int combinator = 0; combinator <= (signalValues.size() - 1) / 20; combinator++) {
            ArrayList<Filter> filters = new ArrayList<>();
            for (int signal = 0; signal < 20 && signal + combinator * 20 < signalValues.size(); signal++) {
                filters.add(new Filter(new SignalID(combinator * 20 + signal), signalValues.get(combinator * 20 + signal), signal + 1));
            }
            entities.add(new Entity(
                    "constant-combinator",
                    new Position(-width / 2 + combinator * 1F, 1F),
                    null,
                    null,
                    new ControlBehaviour(filters),
                    new Connection(
                            new ConnectionPoint(new ArrayList<>() {{
                                add(new ConnectionData(Entity.getEntityCount()));
                            }}, null)
                    )
            ));
        }
        Blueprint blueprint = new Blueprint(
                "FactorioDMM-output",
                entities,
                new Icon[] {new Icon(1, new SignalID("small-lamp"))},
                281479271743489L
        );
        previewTextArea.setText(BlueprintStringEncoder.Encode(blueprint));
        previewTextArea.setWrapText(true);
    }

    @FXML
    private void math() {
        //calculate raw values from pixels without optimisation
        int[][] arrangement = new int[height][width];
        if (pictureList != null) {
            for (int imageCount = 0; imageCount < pictureList.size() && imageCount < 32; imageCount++) {
                Image image = new Image(pictureList.get(imageCount).toURI().toString());
                PixelReader pixelReader = image.getPixelReader();
                for (int readY = 0; readY < height; readY++) {
                    for (int readX = 0; readX < width; readX++) {
                        if (readX < image.getWidth() && readY < image.getHeight() && pixelReader.getColor(readX, readY).getBrightness() >= brightness) {
                            arrangement[readY][readX] = setBit(imageCount, arrangement[readY][readX]);
                        }
                    }
                }
            }
        }

        //optimize values into output
        ArrayList<Entity> entities = new ArrayList<>();
        ArrayList<Integer> signalValues = new ArrayList<>();
        for (int row = 0; row < height; row++) {
            for (int column = 0; column < width; column++) {
                CircuitCondition condition = new CircuitCondition();
                if (signalValues.contains(arrangement[row][column])) {
                    condition.setFirstSignal(new SignalID(signalValues.indexOf(arrangement[row][column])));
                } else if (arrangement[row][column] != 0) {
                    signalValues.add(arrangement[row][column]);
                    condition.setFirstSignal(new SignalID(signalValues.size() - 1));
                }
                ArrayList<ConnectionData> connections = new ArrayList<>();
                //connect up
                if (row != 0) connections.add(new ConnectionData(Entity.getEntityCount() - width + 1));
                //connect left
                if (row == height - 1 && column != 0) connections.add(new ConnectionData(Entity.getEntityCount()));
                entities.add(new Entity(
                        "small-lamp",
                        new Position(-width / 2 + column * 1F, -height + row * 1F),
                        null,
                        null,
                        new ControlBehaviour(true, condition),
                        new Connection(new ConnectionPoint(null, connections))
                ));
            }
        }
        entities.add(new Entity(
                "constant-combinator",
                new Position(-width / 2 + 2F, 0F),
                4,
                null,
                new ControlBehaviour(new ArrayList<Filter>() {{
                    add(new Filter(new SignalID("signal-black"), 0, 1));
                }}),
                null
        ));
        entities.add(new Entity(
                "arithmetic-combinator",
                new Position(-width / 2 + 0.5F, 0F),
                6,
                null,
                new ControlBehaviour(new ArithmeticCondition(
                        new SignalID("signal-each"),
                        new SignalID("signal-black"),
                        "<<",
                        new SignalID("signal-each")
                )),
                new Connection(
                        new ConnectionPoint(new ArrayList<ConnectionData>() {{
                            add(new ConnectionData(Entity.getEntityCount() + 2));
                        }}, new ArrayList<ConnectionData>() {{
                            add(new ConnectionData(Entity.getEntityCount()));
                        }}),
                        new ConnectionPoint(null, new ArrayList<ConnectionData>() {{
                            add(new ConnectionData(width * height - width + 1));
                        }})
                )
        ));
        for (int combinator = 0; combinator <= (signalValues.size() - 1) / 20; combinator++) {
            ArrayList<Filter> filters = new ArrayList<>();
            for (int signal = 0; signal < 20 && signal + combinator * 20 < signalValues.size(); signal++) {
                filters.add(new Filter(new SignalID(combinator * 20 + signal), signalValues.get(combinator * 20 + signal), signal + 1));
            }
            entities.add(new Entity(
                    "constant-combinator",
                    new Position(-width / 2 + combinator * 1F, 1F),
                    null,
                    null,
                    new ControlBehaviour(filters),
                    new Connection(
                            new ConnectionPoint(new ArrayList<ConnectionData>() {{
                                add(new ConnectionData(Entity.getEntityCount()));
                            }}, null)
                    )
            ));
        }
        Blueprint blueprint = new Blueprint(
                "FactorioDMM-output",
                entities,
                new Icon[] {new Icon(1, new SignalID("small-lamp"))},
                281479271743489L
        );
        previewTextArea.setText(BlueprintStringEncoder.Encode(blueprint));
        previewTextArea.setWrapText(true);
    }


    public void start() {
        System.out.println("Welcome to ReQL! input h or help for more instructions\n" +
                "Type 'exit' to close");
        System.out.println("Input command: ");
        do {
            try {
                System.out.print("> ");
                String command = in.readLine();
                processCommand(command);
            } catch (IOException | IllegalArgumentException e) {
                e.printStackTrace();
            }
        } while((loopSwitch));
    }

    public void start() {
        System.out.println("Welcome to ReQL! input h or help for more instructions\n" +
                "Type 'exit' to close");
        System.out.println("Input command: ");
        do {
            try {
                System.out.print("> ");
                String command = in.readLine();
                processCommand(command);
            } catch (IOException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            }
        } while((loopSwitch));
    }

Merge Catch [catch(IOException e), catch(IllegalArgumentException e)] to catch(IOException|IllegalArgumentException e) in method public start() : void from class edu.neumont.csc180.rosado.jose.ConsoleUI


    /**
     * Peeks multiple incoming messages from the queue without removing them. If
     * there are no messages available in the queue it returns an empty list.
     *
     * @param correlationId (optional) transaction id to trace execution through
     *                      call chain.
     * @param messageCount  a maximum number of messages to peek.
     * @return a list with messages.
     */
    @Override
    public List<MessageEnvelope> peekBatch(String correlationId, int messageCount) {
        List<MessageEnvelope> messages = new ArrayList<>();

        synchronized (_lock) {
            for (int index = 0; index < _messages.size() && index < messageCount; index++)
                messages.add(_messages.get(index));
        }

        _logger.trace(correlationId, "Peeked %d messages on %s", messages.size(), this);

        return messages;
    }

    /**
     * Peeks multiple incoming messages from the queue without removing them. If
     * there are no messages available in the queue it returns an empty list.
     *
     * @param correlationId (optional) transaction id to trace execution through
     *                      call chain.
     * @param messageCount  a maximum number of messages to peek.
     * @return a list with messages.
     */
    @Override
    public List<MessageEnvelope> peekBatch(String correlationId, int messageCount) {
        List<MessageEnvelope> messages = new ArrayList<MessageEnvelope>();

        synchronized (_lock) {
            for (int index = 0; index < _messages.size() && index < messageCount; index++)
                messages.add(_messages.get(index));
        }

        _logger.trace(correlationId, "Peeked %d messages on %s", messages.size(), this);

        return messages;
    }

Replace Generic With Diamond ArrayList<MessageEnvelope> with ArrayList<> in method public peekBatch(correlationId String, messageCount int) : List<MessageEnvelope> from class org.pipservices3.messaging.queues.MemoryMessageQueue


    public GameMap sectorAbstract2(int gridSize) {
        int currentNum = START_NUM - 1;    // Start # above 42 which is a wall
        GameMap baseMap = this.copyMap();
        int maxr, maxc;
        int numSectors = (int) (Math.ceil(rows * 1.0 / gridSize) * Math.ceil(cols * 1.0 / gridSize));

        baseMap.numRegions = new int[numSectors];
        int totalRegions = 0;
        ExpandArray neighbors = new ExpandArray(10);

        //For # of rows on grid
        for (int i = 0; i < (int) Math.ceil(rows * 1.0 / gridSize); i++) {
            //top row of this grid cell
            int startRow = i * gridSize;

            //bottom row of this grid cell
            maxr = i * gridSize + gridSize;

            //if bottom of the grid exceed the map~
            if (maxr > this.rows) maxr = rows;

            //For # of cols on grid
            for (int j = 0; j < (int) Math.ceil(cols * 1.0 / gridSize); j++) {
                //first col of this grid cell
                int startCol = j * gridSize;

                //last col of this grid cell
                maxc = j * gridSize + gridSize;

                //if last col of the grid exceed the map~
                if (maxc > this.cols) maxc = cols;

                //??Counter for # of states in the region(sector) that isn't a wall
                int numRegionsInSector = 0;

                //for each row in this grid cell
                for (int r = 0; r < gridSize; r++) {
                    //for each col in this grid cell
                    for (int c = 0; c < gridSize; c++) {
                        //pointer to a row
                        int row = startRow + r;

                        //pointer to a col
                        int col = startCol + c;

                        //if this state is valid and isn't a wall and is ' '
                        if (baseMap.isValid(row, col) && !baseMap.isWall(row, col) && baseMap.squares[row][col] == ' ') {    // Open cell for abstraction - perform constrained BFS within this sector to label all nodes in sector
                            currentNum++;
                            numRegionsInSector++;

                            Queue<Integer> stateIds = new LinkedList<>();

                            //?Calculate and return some sort of id
                            stateIds.add(baseMap.getId(row, col));

                            //?Assign some number to this square
                            baseMap.squares[row][col] = currentNum;

                            while (!stateIds.isEmpty()) {
                                int id = stateIds.remove();
                                row = baseMap.getRow(id);//Row of state
                                col = baseMap.getCol(id);//Col of state

                                // Generate neighbors and add to list if in region
                                baseMap.getNeighbors(row, col, neighbors);

                                //For number of neighbors
                                for (int n = 0; n < neighbors.num(); n++) {

                                    int nid = neighbors.get(n);//ID of neighbor state
                                    int nr = baseMap.getRow(nid);//Row of that neighbor
                                    int nc = baseMap.getCol(nid);//Col of that neighbor

                                    //Check if neighbor is in range
                                    if (baseMap.isOpenInRange(nr, nc, maxr, maxc, gridSize)) {
                                        //Add neighbor
                                        baseMap.squares[nr][nc] = currentNum;
                                        stateIds.add(nid);
                                    }
                                }
                            }

                            // Put in new group
                            Color color = new Color(generator.nextFloat(), generator.nextFloat(), generator.nextFloat());
                            baseMap.colors.put(currentNum, color);
                        }
                    }
                }
                totalRegions += numRegionsInSector; //increment region count
                //???
                baseMap.numRegions[i * (int) Math.ceil(cols * 1.0 / gridSize) + j] = numRegionsInSector;
            }
        }

        baseMap.states = totalRegions;
        System.out.println("Number of areas: " + (baseMap.states));

        baseMap.buildAbstractProblem(gridSize);
        //	dbstat.addStat(12, endTime-currentTime);
        //dbstat.addStat(11, baseMap.states);
        //dbstat.addStat(7, baseMap.states);
        return baseMap;
    }

    public GameMap sectorAbstract2(int gridSize) {
        int currentNum = START_NUM - 1;    // Start # above 42 which is a wall
        GameMap baseMap = this.copyMap();
        int maxr, maxc;
        int numSectors = (int) (Math.ceil(rows * 1.0 / gridSize) * Math.ceil(cols * 1.0 / gridSize));

        baseMap.numRegions = new int[numSectors];
        int totalRegions = 0;
        ExpandArray neighbors = new ExpandArray(10);

        //For # of rows on grid
        for (int i = 0; i < (int) Math.ceil(rows * 1.0 / gridSize); i++) {
            //top row of this grid cell
            int startRow = i * gridSize;

            //bottom row of this grid cell
            maxr = i * gridSize + gridSize;

            //if bottom of the grid exceed the map~
            if (maxr > this.rows) maxr = rows;

            //For # of cols on grid
            for (int j = 0; j < (int) Math.ceil(cols * 1.0 / gridSize); j++) {
                //first col of this grid cell
                int startCol = j * gridSize;

                //last col of this grid cell
                maxc = j * gridSize + gridSize;

                //if last col of the grid exceed the map~
                if (maxc > this.cols) maxc = cols;

                //??Counter for # of states in the region(sector) that isn't a wall
                int numRegionsInSector = 0;

                //for each row in this grid cell
                for (int r = 0; r < gridSize; r++) {
                    //for each col in this grid cell
                    for (int c = 0; c < gridSize; c++) {
                        //pointer to a row
                        int row = startRow + r;

                        //pointer to a col
                        int col = startCol + c;

                        //if this state is valid and isn't a wall and is ' '
                        if (baseMap.isValid(row, col) && !baseMap.isWall(row, col) && baseMap.squares[row][col] == ' ') {    // Open cell for abstraction - perform constrained BFS within this sector to label all nodes in sector
                            currentNum++;
                            numRegionsInSector++;

                            Queue<Integer> stateIds = new LinkedList<Integer>();

                            //?Calculate and return some sort of id
                            stateIds.add(baseMap.getId(row, col));

                            //?Assign some number to this square
                            baseMap.squares[row][col] = currentNum;

                            while (!stateIds.isEmpty()) {
                                int id = stateIds.remove();
                                row = baseMap.getRow(id);//Row of state
                                col = baseMap.getCol(id);//Col of state

                                // Generate neighbors and add to list if in region
                                baseMap.getNeighbors(row, col, neighbors);

                                //For number of neighbors
                                for (int n = 0; n < neighbors.num(); n++) {

                                    int nid = neighbors.get(n);//ID of neighbor state
                                    int nr = baseMap.getRow(nid);//Row of that neighbor
                                    int nc = baseMap.getCol(nid);//Col of that neighbor

                                    //Check if neighbor is in range
                                    if (baseMap.isOpenInRange(nr, nc, maxr, maxc, gridSize)) {
                                        //Add neighbor
                                        baseMap.squares[nr][nc] = currentNum;
                                        stateIds.add(nid);
                                    }
                                }
                            }

                            // Put in new group
                            Color color = new Color(generator.nextFloat(), generator.nextFloat(), generator.nextFloat());
                            baseMap.colors.put(currentNum, color);
                        }
                    }
                }
                totalRegions += numRegionsInSector; //increment region count
                //???
                baseMap.numRegions[i * (int) Math.ceil(cols * 1.0 / gridSize) + j] = numRegionsInSector;
            }
        }

        baseMap.states = totalRegions;
        System.out.println("Number of areas: " + (baseMap.states));

        baseMap.buildAbstractProblem(gridSize);
        //	dbstat.addStat(12, endTime-currentTime);
        //dbstat.addStat(11, baseMap.states);
        //dbstat.addStat(7, baseMap.states);
        return baseMap;
    }

Replace Generic With Diamond LinkedList<Integer> with LinkedList<> in method public sectorAbstract2(gridSize int) : GameMap from class map.GameMap


    public ArrayList<SearchState> computePath(SearchState start, SearchState goal, StatsRecord stats) {
        ArrayList<SubgoalDBRecord> used = new ArrayList<>();
        ArrayList<SearchState> newPath;
        SearchState currentStart = start;
        SearchState currentGoal = goal;
        SubgoalDBRecord currentRecord = null;
        int currentIndex = 0;
        int[] subgoalList = null;
        int cutoff = 10000;
        GenHillClimbing subgoalSearchAlg = new GenHillClimbing(problem, cutoff);
        AStar astar = new AStar(problem);
        subgoals.clear();

        long startTime, endTime, startTime2;

        ArrayList<SearchState> path = new ArrayList<SearchState>();

        ArrayList<SearchState> pathStart = new ArrayList<SearchState>();

        ArrayList<SearchState> pathEnd = new ArrayList<SearchState>();

        startTime = System.nanoTime();
        SearchState startRegionCenter = abstractProblem.findRegion2(start, pathStart, 0);
        SearchState goalRegionCenter = abstractProblem.findRegion2(goal, pathEnd, 1);

        // Search the database for records
        startTime2 = System.nanoTime();
        ArrayList<SubgoalDBRecord> records = database.findNearest(problem, startRegionCenter, goalRegionCenter, subgoalSearchAlg, 1, stats, null);

/*		System.out.println("The Record:");
		System.out.println(records.toString());
		System.out.println("Record End");*/

        endTime = System.nanoTime();

        if (records.size() >= 1) {
            currentRecord = records.get(0);
            used.add(currentRecord);
            // System.out.println("Using subgoal record from database: "+currentRecord.toString(problem));
            // System.out.println("Using subgoal record from database: "+currentRecord.getId());
            subgoalList = currentRecord.getSubgoalList();
            currentIndex = -1;

            currentGoal = new SearchState(currentRecord.getStartId());
            subgoals.add(currentGoal);
            endTime = System.nanoTime();
            stats.updateMaxTime(endTime - startTime);
            SearchUtil.computePathCost(path, stats, problem); // Compute path
            // costs up to
            // this point

            while (true) {

                if (currentStart == start) {

                    if (subgoalList == null || subgoalList.length == 0) {
                        newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    } else {
                        SearchState front_Op = new SearchState(subgoalList[0]);
                        newPath = subgoalSearchAlg.computePath(currentStart, front_Op, stats);
                        if (newPath != null) {
                            currentGoal = front_Op;
                            currentIndex++;
                        }
                    }

                    if (newPath == null) {
                        if (pathStart.size() != 0) {
                            newPath = pathStart;
                        } else newPath = astar.computePath(currentStart, currentGoal, stats);
                    }

                } else if (currentGoal == goal) {
                    newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    if (newPath == null && currentStart != goalRegionCenter) {
                        currentGoal = goalRegionCenter;
                        newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    } else if (newPath == null) {

                        if (pathEnd.size() != 0) {
                            newPath = pathEnd;
                        } else newPath = astar.computePath(currentStart, currentGoal, stats);
                    }

                } else {
                    newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                }

                if (newPath == null) { // TODO: Not sure what to do in this case
                    System.out.println("JStar Unable to find subgoal path between " + problem.idToString(currentStart.id) + " and " + problem.idToString(currentGoal.id));
                    currentGoal = goal;
                    return null;
                }

                path = SearchUtil.mergePaths(path, newPath);

                SearchState curr = newPath.get(newPath.size() - 1);

                if (curr.equals(goal)) break;

                if (!curr.equals(currentGoal)) { // Must have been interrupted
                    int times = cutoff;
                    if (times > 100) times = 100;

                    currentStart = newPath.get(newPath.size() - 1);
                    System.out.println("Detect interruption.  Trying database lookup at: " + currentStart);
                    System.out.println("Length of path at interrupt: " + path.size());
                    records = database.findNearest(problem, currentStart, goal, subgoalSearchAlg, 1, stats, null);
                    if (records.size() >= 1) {
                        currentRecord = records.get(0);
                        subgoalList = currentRecord.getSubgoalList();
                        used.add(currentRecord);
                        // System.out.println("Using subgoal record from database: "+currentRecord.toString());
                        currentIndex = -1;
                        // Always go for start
                        currentGoal = new SearchState(currentRecord.getStartId());
                    } else currentGoal = goal;

                    continue;
                }

                if (currentGoal == goal) break;

                currentStart = currentGoal;
                currentIndex++;
                if (subgoalList == null) {
                    if (currentGoal.id == currentRecord.getGoalId()) currentGoal = goal;
                    else currentGoal = new SearchState(currentRecord.getGoalId());
                } else if (currentIndex < subgoalList.length) {
                    currentGoal = new SearchState(subgoalList[currentIndex]);
                    subgoals.add(currentGoal);
                } else currentGoal = goal; // Go towards global goal
            }

            SearchUtil.computePathCost(path, stats, problem);

            endTime = System.nanoTime();
            stats.updateMaxTime(endTime - startTime);

        }
        return path;
    }

    public ArrayList<SearchState> computePath(SearchState start, SearchState goal, StatsRecord stats) {
        ArrayList<SubgoalDBRecord> used = new ArrayList<SubgoalDBRecord>();
        ArrayList<SearchState> newPath;
        SearchState currentStart = start;
        SearchState currentGoal = goal;
        SubgoalDBRecord currentRecord = null;
        int currentIndex = 0;
        int[] subgoalList = null;
        int cutoff = 10000;
        GenHillClimbing subgoalSearchAlg = new GenHillClimbing(problem, cutoff);
        AStar astar = new AStar(problem);
        subgoals.clear();

        long startTime, endTime, startTime2;

        ArrayList<SearchState> path = new ArrayList<SearchState>();

        ArrayList<SearchState> pathStart = new ArrayList<SearchState>();

        ArrayList<SearchState> pathEnd = new ArrayList<SearchState>();

        startTime = System.nanoTime();
        SearchState startRegionCenter = abstractProblem.findRegion2(start, pathStart, 0);
        SearchState goalRegionCenter = abstractProblem.findRegion2(goal, pathEnd, 1);

        // Search the database for records
        startTime2 = System.nanoTime();
        ArrayList<SubgoalDBRecord> records = database.findNearest(problem, startRegionCenter, goalRegionCenter, subgoalSearchAlg, 1, stats, null);

/*		System.out.println("The Record:");
		System.out.println(records.toString());
		System.out.println("Record End");*/

        endTime = System.nanoTime();

        if (records.size() >= 1) {
            currentRecord = records.get(0);
            used.add(currentRecord);
            // System.out.println("Using subgoal record from database: "+currentRecord.toString(problem));
            // System.out.println("Using subgoal record from database: "+currentRecord.getId());
            subgoalList = currentRecord.getSubgoalList();
            currentIndex = -1;

            currentGoal = new SearchState(currentRecord.getStartId());
            subgoals.add(currentGoal);
            endTime = System.nanoTime();
            stats.updateMaxTime(endTime - startTime);
            SearchUtil.computePathCost(path, stats, problem); // Compute path
            // costs up to
            // this point

            while (true) {

                if (currentStart == start) {

                    if (subgoalList == null || subgoalList.length == 0) {
                        newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    } else {
                        SearchState front_Op = new SearchState(subgoalList[0]);
                        newPath = subgoalSearchAlg.computePath(currentStart, front_Op, stats);
                        if (newPath != null) {
                            currentGoal = front_Op;
                            currentIndex++;
                        }
                    }

                    if (newPath == null) {
                        if (pathStart.size() != 0) {
                            newPath = pathStart;
                        } else newPath = astar.computePath(currentStart, currentGoal, stats);
                    }

                } else if (currentGoal == goal) {
                    newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    if (newPath == null && currentStart != goalRegionCenter) {
                        currentGoal = goalRegionCenter;
                        newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                    } else if (newPath == null) {

                        if (pathEnd.size() != 0) {
                            newPath = pathEnd;
                        } else newPath = astar.computePath(currentStart, currentGoal, stats);
                    }

                } else {
                    newPath = subgoalSearchAlg.computePath(currentStart, currentGoal, stats);
                }

                if (newPath == null) { // TODO: Not sure what to do in this case
                    System.out.println("JStar Unable to find subgoal path between " + problem.idToString(currentStart.id) + " and " + problem.idToString(currentGoal.id));
                    currentGoal = goal;
                    return null;
                }

                path = SearchUtil.mergePaths(path, newPath);

                SearchState curr = newPath.get(newPath.size() - 1);

                if (curr.equals(goal)) break;

                if (!curr.equals(currentGoal)) { // Must have been interrupted
                    int times = cutoff;
                    if (times > 100) times = 100;

                    currentStart = newPath.get(newPath.size() - 1);
                    System.out.println("Detect interruption.  Trying database lookup at: " + currentStart);
                    System.out.println("Length of path at interrupt: " + path.size());
                    records = database.findNearest(problem, currentStart, goal, subgoalSearchAlg, 1, stats, null);
                    if (records.size() >= 1) {
                        currentRecord = records.get(0);
                        subgoalList = currentRecord.getSubgoalList();
                        used.add(currentRecord);
                        // System.out.println("Using subgoal record from database: "+currentRecord.toString());
                        currentIndex = -1;
                        // Always go for start
                        currentGoal = new SearchState(currentRecord.getStartId());
                    } else currentGoal = goal;

                    continue;
                }

                if (currentGoal == goal) break;

                currentStart = currentGoal;
                currentIndex++;
                if (subgoalList == null) {
                    if (currentGoal.id == currentRecord.getGoalId()) currentGoal = goal;
                    else currentGoal = new SearchState(currentRecord.getGoalId());
                } else if (currentIndex < subgoalList.length) {
                    currentGoal = new SearchState(subgoalList[currentIndex]);
                    subgoals.add(currentGoal);
                } else currentGoal = goal; // Go towards global goal
            }

            SearchUtil.computePathCost(path, stats, problem);

            endTime = System.nanoTime();
            stats.updateMaxTime(endTime - startTime);

        }
        return path;
    }

Replace Generic With Diamond ArrayList<SubgoalDBRecord> with ArrayList<> in method public computePath(start SearchState, goal SearchState, stats StatsRecord) : ArrayList<SearchState> from class search.JStar


    public void copyMatrixNew(int row, int col, GameMap source, GameMap dest, int sourceval, int destval) {
        Stack<MapPoint> currentSet = new Stack<>();
        HashMap<Integer, Integer> visited = new HashMap<>();
        currentSet.add(new MapPoint(row, col));
        int count = 0;
        while (!currentSet.isEmpty()) {
            MapPoint curPoint = currentSet.pop();
            int id = getId(curPoint.getRow(), curPoint.getCol());
            if (visited.containsKey(id)) continue;

            visited.put(id, null);
            count++;
            // Expand in all directions
            int r = curPoint.getRow();
            int c = curPoint.getCol();

            if (source.squares[r][c] == sourceval)
                // Add check to make sure square is not already assigned
                if (dest.squares[r][c] == ' ') dest.squares[r][c] = destval;

            if (source.isValid(r - 1, c) && !source.isWall(r - 1, c))
                if (source.squares[r - 1][c] == sourceval)    // Above
                    currentSet.add(new MapPoint(r - 1, c));

            if (source.isValid(r - 1, c + 1) && !source.isWall(r - 1, c + 1))
                if (source.squares[r - 1][c + 1] == sourceval) // Top right
                    currentSet.add(new MapPoint(r - 1, c + 1));

            if (source.isValid(r, c + 1) && !source.isWall(r, c + 1))
                if (source.squares[r][c + 1] == sourceval) // Right
                    currentSet.add(new MapPoint(r, c + 1));

            if (source.isValid(r + 1, c + 1) && !source.isWall(r + 1, c + 1))
                if (source.squares[r + 1][c + 1] == sourceval) // Bottom right
                    currentSet.add(new MapPoint(r + 1, c + 1));

            if (source.isValid(r + 1, c) && !source.isWall(r + 1, c))
                if (source.squares[r + 1][c] == sourceval) // Bottom
                    currentSet.add(new MapPoint(r + 1, c));

            if (source.isValid(r + 1, c - 1) && !source.isWall(r + 1, c - 1))
                if (squares[r + 1][c - 1] == sourceval) // Bottom left
                    currentSet.add(new MapPoint(r + 1, c - 1));

            if (source.isValid(r, c - 1) && !source.isWall(r, c - 1))
                if (source.squares[r][c - 1] == sourceval) // Left
                    currentSet.add(new MapPoint(r, c - 1));

            if (source.isValid(r - 1, c - 1) && !source.isWall(r - 1, c - 1))
                if (source.squares[r - 1][c - 1] == sourceval) // Top left
                    currentSet.add(new MapPoint(r - 1, c - 1));
        }

        // System.out.println("Num: "+sourceval+" Copied: "+count);
    }

    public void copyMatrixNew(int row, int col, GameMap source, GameMap dest, int sourceval, int destval) {
        Stack<MapPoint> currentSet = new Stack<MapPoint>();
        HashMap<Integer, Integer> visited = new HashMap<>();
        currentSet.add(new MapPoint(row, col));
        int count = 0;
        while (!currentSet.isEmpty()) {
            MapPoint curPoint = currentSet.pop();
            int id = getId(curPoint.getRow(), curPoint.getCol());
            if (visited.containsKey(id)) continue;

            visited.put(id, null);
            count++;
            // Expand in all directions
            int r = curPoint.getRow();
            int c = curPoint.getCol();

            if (source.squares[r][c] == sourceval)
                // Add check to make sure square is not already assigned
                if (dest.squares[r][c] == ' ') dest.squares[r][c] = destval;

            if (source.isValid(r - 1, c) && !source.isWall(r - 1, c))
                if (source.squares[r - 1][c] == sourceval)    // Above
                    currentSet.add(new MapPoint(r - 1, c));

            if (source.isValid(r - 1, c + 1) && !source.isWall(r - 1, c + 1))
                if (source.squares[r - 1][c + 1] == sourceval) // Top right
                    currentSet.add(new MapPoint(r - 1, c + 1));

            if (source.isValid(r, c + 1) && !source.isWall(r, c + 1))
                if (source.squares[r][c + 1] == sourceval) // Right
                    currentSet.add(new MapPoint(r, c + 1));

            if (source.isValid(r + 1, c + 1) && !source.isWall(r + 1, c + 1))
                if (source.squares[r + 1][c + 1] == sourceval) // Bottom right
                    currentSet.add(new MapPoint(r + 1, c + 1));

            if (source.isValid(r + 1, c) && !source.isWall(r + 1, c))
                if (source.squares[r + 1][c] == sourceval) // Bottom
                    currentSet.add(new MapPoint(r + 1, c));

            if (source.isValid(r + 1, c - 1) && !source.isWall(r + 1, c - 1))
                if (squares[r + 1][c - 1] == sourceval) // Bottom left
                    currentSet.add(new MapPoint(r + 1, c - 1));

            if (source.isValid(r, c - 1) && !source.isWall(r, c - 1))
                if (source.squares[r][c - 1] == sourceval) // Left
                    currentSet.add(new MapPoint(r, c - 1));

            if (source.isValid(r - 1, c - 1) && !source.isWall(r - 1, c - 1))
                if (source.squares[r - 1][c - 1] == sourceval) // Top left
                    currentSet.add(new MapPoint(r - 1, c - 1));
        }

        // System.out.println("Num: "+sourceval+" Copied: "+count);
    }

Replace Generic With Diamond Stack<MapPoint> with Stack<> in method public copyMatrixNew(row int, col int, source GameMap, dest GameMap, sourceval int, destval int) : void from class map.GameMap


    public static int countRevisits(ArrayList<SearchState> path) {
        if (path == null) return 0;
        else {
            HashMap<Integer, Integer> states = new HashMap<>(path.size());
            int revisits = 0;
            for (SearchState searchState : path) {
                int id = searchState.id;
                if (states.containsKey(id)) revisits++;
                else states.put(id, id);
            }
            return revisits;
        }
    }

    public static int countRevisits(ArrayList<SearchState> path) {
        if (path == null) return 0;
        else {
            HashMap<Integer, Integer> states = new HashMap<Integer, Integer>(path.size());
            int revisits = 0;
            for (SearchState searchState : path) {
                int id = searchState.id;
                if (states.containsKey(id)) revisits++;
                else states.put(id, id);
            }
            return revisits;
        }
    }

Replace Generic With Diamond HashMap<Integer,Integer> with HashMap<> in method public countRevisits(path ArrayList<SearchState>) : int from class search.SearchUtil


    public static int distanceRevisits(ArrayList<SearchState> path) {
        int total = 0;
        if (path == null) return 0;
        else {
            HashMap<Integer, Integer> states = new HashMap<>(path.size());
            int revisits = 0;
            for (int i = 0; i < path.size(); i++) {
                int id = path.get(i).id;
                if (states.containsKey(id)) {
                    revisits++;
                    int lastLoc = states.get(id);
                    total += (i - lastLoc - 1);
                    //	System.out.println("Distance: "+(i-lastLoc-1));
                }
                states.put(id, i);    // Always put the latest version as may revisit a state multiple times
            }
            return total;
        }
    }

    public static int distanceRevisits(ArrayList<SearchState> path) {
        int total = 0;
        if (path == null) return 0;
        else {
            HashMap<Integer, Integer> states = new HashMap<Integer, Integer>(path.size());
            int revisits = 0;
            for (int i = 0; i < path.size(); i++) {
                int id = path.get(i).id;
                if (states.containsKey(id)) {
                    revisits++;
                    int lastLoc = states.get(id);
                    total += (i - lastLoc - 1);
                    //	System.out.println("Distance: "+(i-lastLoc-1));
                }
                states.put(id, i);    // Always put the latest version as may revisit a state multiple times
            }
            return total;
        }
    }

Replace Generic With Diamond HashMap<Integer,Integer> with HashMap<> in method public distanceRevisits(path ArrayList<SearchState>) : int from class search.SearchUtil


    public DBStatsRecord() {
        stats = new ArrayList<>();
    }

    public DBStatsRecord() {
        stats = new ArrayList<Object>();
    }

Replace Generic With Diamond ArrayList<Object> with ArrayList<> in method public DBStatsRecord() from class database.DBStatsRecord


    /**
     * Saves the compressed mapping to a file.
     *
     * @param fileName
     */
    public void export(String fileName) {
        try (PrintWriter out = new PrintWriter(fileName)) {
            out.println(count);
            out.println(numRegions);

            // Write out group id to group seed id mapping
            for (int i = 0; i < numRegions; i++)
                out.println(groups[i][0] + " " + groups[i][1]);
            // Write out node and seeds array
            for (int i = 0; i < count; i++)
                out.print(nodeIds[i] + " ");
            out.println();
            for (int i = 0; i < count; i++)
                out.print(seedIds[i] + " ");
            out.println();
        } catch (FileNotFoundException e) {
            System.out.println("Error with output file: " + e);
        }
    }

    /**
     * Saves the compressed mapping to a file.
     *
     * @param fileName
     */
    public void export(String fileName) {
        PrintWriter out = null;
        try {
            out = new PrintWriter(fileName);
            out.println(count);
            out.println(numRegions);

            // Write out group id to group seed id mapping
            for (int i = 0; i < numRegions; i++)
                out.println(groups[i][0] + " " + groups[i][1]);
            // Write out node and seeds array
            for (int i = 0; i < count; i++)
                out.print(nodeIds[i] + " ");
            out.println();
            for (int i = 0; i < count; i++)
                out.print(seedIds[i] + " ");
            out.println();
        } catch (FileNotFoundException e) {
            System.out.println("Error with output file: " + e);
        } finally {
            if (out != null) out.close();
        }
    }

Try With Resources try(PrintWriter out=new PrintWriter(fileName)) in method public export(fileName String) : void from class database.IndexDB


    /**
     * Saves the subgoal database (records only).
     *
     * @param fileName
     */
    public void exportDB(String fileName) {
        try (PrintWriter out = new PrintWriter(fileName)) {
            out.println(records.size());
            for (SubgoalDBRecord record : records) record.save(out);
        } catch (FileNotFoundException e) {
            System.out.println("Error with output file: " + e);
        }
    }

    /**
     * Saves the subgoal database (records only).
     *
     * @param fileName
     */
    public void exportDB(String fileName) {
        PrintWriter out = null;
        try {
            out = new PrintWriter(fileName);
            out.println(records.size());

            for (int i = 0; i < records.size(); i++)
                records.get(i).save(out);
        } catch (FileNotFoundException e) {
            System.out.println("Error with output file: " + e);
        } finally {
            if (out != null) out.close();
        }
    }

Try With Resources try(PrintWriter out=new PrintWriter(fileName)) in method public exportDB(fileName String) : void from class database.SubgoalDB