    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player && !isDisabled) {
            Player player = (Player) sender;
            if (command.getName().equalsIgnoreCase("codropi")){
                player.sendMessage(ChatColor.GOLD+dropChances.toString());
            }
            if (command.getName().equalsIgnoreCase("drop")){
                HashMap<String, Setting> setting = playerSettings.get(player.getUniqueId().toString());
                boolean wasOk = false;
                if (args.length == 0){
                    playerSettings.get(player.getUniqueId().toString()).forEach((material, preferences)-> player.sendMessage(ChatColor.GOLD+material+": "+preferences.isOn()));
                    wasOk = true;
                }
                else if (args.length > 1) player.sendMessage(ChatColor.GRAY+"Komenda powinna wyglądać mniej więcej tak:\n"+ChatColor.GOLD+"/drop <info, stack, cobble, zelazo, lapis, redstone, wegiel, diament, emerald, gold>");
                else {
                    if (args[0].equalsIgnoreCase("cobble")) {
                        wasOk = true;
                            setting.get("COBBLE").setOn(!setting.get("COBBLE").isOn());
                        if (!setting.get("COBBLE").isOn())
                            player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + "cobbla" + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączony");
                        else
                            player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + "cobbla" + ChatColor.GOLD + " jest teraz "+ChatColor.RED+"wyłączony");
                    } else if (args[0].equalsIgnoreCase("stack")) {
                        wasOk = true;
                        setting.get("STACK").setOn(!setting.get("STACK").isOn());
                        if (setting.get("STACK").isOn())
                            player.sendMessage(ChatColor.RED + "Stackowanie" + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączone");
                        else
                            player.sendMessage(ChatColor.RED + "Stackowanie" + ChatColor.GOLD +" jest teraz "+ChatColor.RED+"wyłączone");

                    } else {
                        for (int i = 0; i < MyEvents.set.length; i++) {
                            if (!MyEvents.set[i].equals("STACK") && !MyEvents.set[i].equals("COBBLE")){
                            if (args[0].equalsIgnoreCase(MyEvents.set[i])) {
                                setting.get(MyEvents.set[i]).setOn(!setting.get(MyEvents.set[i]).isOn());
                                if (setting.get(MyEvents.set[i]).isOn()) {
                                    player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + MyEvents.set[i] + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączony");
                                } else {
                                    player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + MyEvents.set[i] + ChatColor.GOLD + " jest teraz "+ChatColor.RED+"wyłączony");
                                }
                                wasOk = true;
                            }
                        }}
                    }
                }
                if (!wasOk){
                    player.sendMessage(ChatColor.GRAY+"Nieznany argument!\nKomenda powinna wyglądać mniej więcej tak:\n"+ChatColor.GOLD+"/drop <info, stack, cobble, zelazo, lapis, redstone, wegiel, diament, emerald, gold>");

                }

            }
        }
        else if (sender instanceof ConsoleCommandSender)
            if (command.getName().equalsIgnoreCase("emergencyDisable")) {
                isDisabled = !isDisabled;
                sender.sendMessage("PluginDisabled: " + isDisabled);
            }
            if (command.getName().equalsIgnoreCase("shutdown") && args.length == 1){
                long time = Long.parseLong(args[0])*1000;
                long timeToStop = System.currentTimeMillis() + time;
                Runnable thread = () -> {
                    long startTime = System.currentTimeMillis(); //Moment in time of starting this command
                    long timer = System.currentTimeMillis(); //This is a timer that will count seconds untill 10 then reset
                    long lastDisplayedTime = -60000; // Last time when remaining minutes were displayed

                    while ((System.currentTimeMillis() - startTime) < time) {
                        if (System.currentTimeMillis() > timer+1000) {
                            timer = System.currentTimeMillis();
                            Object[] players = plugin.getServer().getOnlinePlayers().toArray();
                            if (timeToStop - System.currentTimeMillis() >= 60000) {
                                if (System.currentTimeMillis() - lastDisplayedTime >= 60000) {

                                    for (int i = 0; i < players.length; i++) {
                                    Player player = (Player) players[i];

                                        player.sendTitle(ChatColor.RED + "Serwer wyłączony za: " + (int) ((time / 60000) - (System.currentTimeMillis() - startTime) / 60000) + " minut", null, 10, 80, 10);
                                        timer = System.currentTimeMillis();
                                        lastDisplayedTime = System.currentTimeMillis();
                                    }
                                }
                            }
                                    else {
                                        for (int i = 0; i < players.length; i++) {
                                            Player player = (Player) players[i];
                                            player.sendTitle(ChatColor.RED + "Serwer wyłączony za: " + (int) ((time / 1000) - (System.currentTimeMillis() - startTime) / 1000) + " sekund", null, 0, 40, 0);
                                    }
                                }
                            }
                        }

                    };
                Bukkit.getScheduler().runTaskAsynchronously(plugin, thread);
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "save-all");
                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop");
                    }
                }, time*20/1000);
            }
        return false;

    }

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

        if (sender instanceof Player && !isDisabled) {
            Player player = (Player) sender;
            if (command.getName().equalsIgnoreCase("codropi")){
                player.sendMessage(ChatColor.GOLD+dropChances.toString());
            }
            if (command.getName().equalsIgnoreCase("drop")){
                HashMap<String, Setting> setting = playerSettings.get(player.getUniqueId().toString());
                boolean wasOk = false;
                if (args.length == 0){
                    playerSettings.get(player.getUniqueId().toString()).forEach((material, preferences)->{
                        player.sendMessage(ChatColor.GOLD+material+": "+preferences.isOn());
                    });
                }
                if (args.length > 1) player.sendMessage(ChatColor.GRAY+"Komenda powinna wyglądać mniej więcej tak:\n"+ChatColor.GOLD+"/drop <info, stack, cobble, zelazo, lapis, redstone, wegiel, diament, emerald, gold>");
                else {
                    if (args[0].equalsIgnoreCase("cobble")) {
                        wasOk = true;
                            setting.get("COBBLE").setOn(!setting.get("COBBLE").isOn());
                        if (!setting.get("COBBLE").isOn())
                            player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + "cobbla" + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączony");
                        else
                            player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + "cobbla" + ChatColor.GOLD + " jest teraz "+ChatColor.RED+"wyłączony");
                    } else if (args[0].equalsIgnoreCase("stack")) {
                        wasOk = true;
                        setting.get("STACK").setOn(!setting.get("STACK").isOn());
                        if (setting.get("STACK").isOn())
                            player.sendMessage(ChatColor.RED + "Stackowanie" + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączone");
                        else
                            player.sendMessage(ChatColor.RED + "Stackowanie" + ChatColor.GOLD +" jest teraz "+ChatColor.RED+"wyłączone");

                    } else {
                        for (int i = 0; i < MyEvents.set.length; i++) {
                            if (!MyEvents.set[i].equals("STACK") && !MyEvents.set[i].equals("COBBLE")){
                            if (args[0].equalsIgnoreCase(MyEvents.set[i])) {
                                setting.get(MyEvents.set[i]).setOn(!setting.get(MyEvents.set[i]).isOn());
                                if (setting.get(MyEvents.set[i]).isOn()) {
                                    player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + MyEvents.set[i] + ChatColor.GOLD + " jest teraz "+ChatColor.GREEN+"włączony");
                                } else {
                                    player.sendMessage(ChatColor.GOLD + "Drop " + ChatColor.AQUA + MyEvents.set[i] + ChatColor.GOLD + " jest teraz "+ChatColor.RED+"wyłączony");
                                }
                                wasOk = true;
                            }
                        }}
                    }
                }
                if (!wasOk){
                    player.sendMessage(ChatColor.GRAY+"Nieznany argument!\nKomenda powinna wyglądać mniej więcej tak:\n"+ChatColor.GOLD+"/drop <info, stack, cobble, zelazo, lapis, redstone, wegiel, diament, emerald, gold>");

                }

            }
        }
        else if (sender instanceof ConsoleCommandSender)
            if (command.getName().equalsIgnoreCase("emergencyDisable")) {
                isDisabled = !isDisabled;
                sender.sendMessage("PluginDisabled: " + isDisabled);
            }
            if (command.getName().equalsIgnoreCase("shutdown") && args.length == 1){
                long time = Long.parseLong(args[0])*1000;
                boolean wylacz = false;
                Runnable thread = new Runnable() {
                    @Override
                    public void run() {
                        long startTime = System.currentTimeMillis();
                        long timer = System.currentTimeMillis();
                        while ((System.currentTimeMillis() - startTime) < time) {
                            if (System.currentTimeMillis() > timer+1000){
                                timer = System.currentTimeMillis();
                                long currentTime = System.currentTimeMillis();
                                Object[] players = plugin.getServer().getOnlinePlayers().toArray();
                                for (int i = 0; i < players.length; i++) {
                                    Player player = (Player) players[i];
                                        if (System.currentTimeMillis() > timer + 60000) {
                                            player.sendTitle(ChatColor.RED + "Serwer wyłączony za: " + (int) ((time / 60000) - (currentTime - startTime) / 60000) + " minut", null, 10, 80, 10);
                                            timer = System.currentTimeMillis();
                                    }
                                    else player.sendTitle(ChatColor.RED + "Serwer wyłączony za: "+ (int)((time/1000) - (currentTime-startTime)/1000)+" sekund", null, 0, 40, 0);
                                }
                            }

                        }

                    }

                };
                Bukkit.getScheduler().runTaskAsynchronously(plugin, thread);
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
                    @Override
                    public void run() {
                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "save-all");
                        Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "stop");
                    }
                }, time*20/1000);
            }
        return false;

    }

Replace Anonymous With Lambda me.apisek12.plugin.PluginMain.onCommand.thread.new Runnable with () -> {long startTime=System.currentTimeMillis(); in method public onCommand(sender CommandSender, command Command, label String, args String[]) : boolean from class me.apisek12.plugin.PluginMain


    @Override
    public void onEnable() {

        saveDefaultConfig();
        saveConfig();

        ConfigurationSection cs = getConfig().getConfigurationSection("users");
        if (cs != null) {
            Set<String> keyList = cs.getKeys(false);
            keyList.forEach((user) -> {
                ConfigurationSection materialsSection = cs.getConfigurationSection(user);
                HashMap<String, Setting> settings = new HashMap<>();

                for (int i = 0; i < materialsSection.getKeys(false).toArray().length; i++) {
                    String materialName = (String) materialsSection.getKeys(false).toArray()[i];
                    boolean setting = (boolean) materialsSection.get(materialName);
                    settings.put(materialName, new Setting(setting, materialName));
                }
                playerSettings.put(user, settings);

            });
        }

        loadChances();
        loadChestChances();
        Bukkit.getServer().getConsoleSender().sendMessage("[DropPlugin]"+ChatColor.GREEN + "Confing Loaded, Plugin enabled!");
        plugin = this;
        this.getServer().getPluginManager().registerEvents(new MyEvents(), this);
        Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, () -> {
            if (Bukkit.getServer().getOnlinePlayers().size() > 0){
                for (int i = 0; i < Bukkit.getServer().getOnlinePlayers().toArray().length; i++){
                    Player player = (Player) Bukkit.getServer().getOnlinePlayers().toArray()[i];
                    if (playerSettings.get(player.getUniqueId().toString()).get("STACK").isOn()){
                        boolean tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.REDSTONE), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.REDSTONE, 9));
                                player.getInventory().addItem(new ItemStack(Material.REDSTONE_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.LAPIS_LAZULI), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.LAPIS_LAZULI, 9));
                                player.getInventory().addItem(new ItemStack(Material.LAPIS_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.COAL), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.COAL, 9));
                                player.getInventory().addItem(new ItemStack(Material.COAL_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.IRON_INGOT), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.IRON_INGOT, 9));
                                player.getInventory().addItem(new ItemStack(Material.IRON_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.DIAMOND), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.DIAMOND, 9));
                                player.getInventory().addItem(new ItemStack(Material.DIAMOND_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.GOLD_INGOT), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.GOLD_INGOT, 9));
                                player.getInventory().addItem(new ItemStack(Material.GOLD_BLOCK));

                            }
                            else tak = false;
                        }
                        tak = true;
                        while (tak){
                            if (player.getInventory().containsAtLeast(new ItemStack(Material.EMERALD), 9)){
                                player.getInventory().removeItem(new ItemStack(Material.EMERALD, 9));
                                player.getInventory().addItem(new ItemStack(Material.EMERALD_BLOCK));

                            }
                            else tak = false;
                        }
                    }
                }
            }
    }, 40L, 80L);

        MyEvents.set = new String[dropChances.keySet().toArray().length];
        for (int i = 0; i < dropChances.keySet().toArray().length; i++) {
            MyEvents.set[i] = (String) dropChances.keySet().toArray()[i];
        }

        playerSettings.forEach((name, settings) -> {
            for (int i = 0; i < MyEvents.set.length; i++) {
                if (!settings.containsKey(MyEvents.set[i])) settings.put(MyEvents.set[i], new Setting(true, MyEvents.set[i]));
            }
        });
    }

    @Override
    public void onEnable() {

        saveDefaultConfig();
        saveConfig();

        ConfigurationSection cs = getConfig().getConfigurationSection("users");
        if (cs != null) {
            Set<String> keyList = cs.getKeys(false);
            keyList.forEach((user) -> {
                ConfigurationSection materialsSection = cs.getConfigurationSection(user);
                HashMap<String, Setting> settings = new HashMap<>();

                for (int i = 0; i < materialsSection.getKeys(false).toArray().length; i++) {
                    String materialName = (String) materialsSection.getKeys(false).toArray()[i];
                    boolean setting = (boolean) materialsSection.get(materialName);
                    settings.put(materialName, new Setting(setting, materialName));
                }
                playerSettings.put(user, settings);

            });
        }

        loadChances();
        loadChestChances();
        Bukkit.getServer().getConsoleSender().sendMessage("[DropPlugin]"+ChatColor.GREEN + "Confing Loaded, Plugin enabled!");
        plugin = this;
        this.getServer().getPluginManager().registerEvents(new MyEvents(), this);
        Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
            @Override
            public void run() {
                if (Bukkit.getServer().getOnlinePlayers().size() > 0){
                    for (int i = 0; i < Bukkit.getServer().getOnlinePlayers().toArray().length; i++){
                        Player player = (Player) Bukkit.getServer().getOnlinePlayers().toArray()[i];
                        if (playerSettings.get(player.getUniqueId().toString()).get("STACK").isOn()){
                            boolean tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.REDSTONE), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.REDSTONE, 9));
                                    player.getInventory().addItem(new ItemStack(Material.REDSTONE_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.LAPIS_LAZULI), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.LAPIS_LAZULI, 9));
                                    player.getInventory().addItem(new ItemStack(Material.LAPIS_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.COAL), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.COAL, 9));
                                    player.getInventory().addItem(new ItemStack(Material.COAL_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.IRON_INGOT), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.IRON_INGOT, 9));
                                    player.getInventory().addItem(new ItemStack(Material.IRON_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.DIAMOND), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.DIAMOND, 9));
                                    player.getInventory().addItem(new ItemStack(Material.DIAMOND_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.GOLD_INGOT), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.GOLD_INGOT, 9));
                                    player.getInventory().addItem(new ItemStack(Material.GOLD_BLOCK));

                                }
                                else tak = false;
                            }
                            tak = true;
                            while (tak){
                                if (player.getInventory().containsAtLeast(new ItemStack(Material.EMERALD), 9)){
                                    player.getInventory().removeItem(new ItemStack(Material.EMERALD, 9));
                                    player.getInventory().addItem(new ItemStack(Material.EMERALD_BLOCK));

                                }
                                else tak = false;
                            }
                        }
                    }
                }
        }}, 40L, 80L);

        MyEvents.set = new String[dropChances.keySet().toArray().length];
        for (int i = 0; i < dropChances.keySet().toArray().length; i++) {
            MyEvents.set[i] = (String) dropChances.keySet().toArray()[i];
        }

        playerSettings.forEach((name, settings) -> {
            for (int i = 0; i < MyEvents.set.length; i++) {
                if (!settings.containsKey(MyEvents.set[i])) settings.put(MyEvents.set[i], new Setting(true, MyEvents.set[i]));
            }
        });
    }

Replace Anonymous With Lambda me.apisek12.plugin.PluginMain.onEnable.runTaskTimerAsynchronously.new Runnable with () -> {if(Bukkit.getServer().getOnlinePlayers().size() > 0){for(int i=0; i < Bukkit.getServer().getOnlinePlayers().toArray().length; i++){Player player=(Player)Bukkit.getServer().getOnlinePlayers().toArray()[i]; in method public onEnable() : void from class me.apisek12.plugin.PluginMain


	public void scheduleTestTimerHandler(){
		ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
		// do this code every 20 seconds
		executorService.scheduleAtFixedRate(() -> {
			try {
				scheduledTests = App.getScheduledTestsActive();
			} catch (Exception e) {
				e.printStackTrace();
			}
			LocalDateTime currentDateTime = LocalDateTime.now();
			assert scheduledTests != null;
			for (ScheduledTest scheduledTest : scheduledTests) {
				LocalDateTime scheduledDateTime = LocalDateTime.of(scheduledTest.getDate(), scheduledTest.getTime());
				long timeLimitMinutes = scheduledTest.getTimeLimit();

				LocalDateTime endTime = scheduledDateTime.plusMinutes(timeLimitMinutes);

				if(scheduledTest.getStatus()==1 && currentDateTime.isAfter(endTime)) // test is done but not yet updated in the db
				{
					scheduledTest.setStatus(2);
					App.addScheduleTest(scheduledTest);
				}
				else if(scheduledTest.getStatus()==0) { // before test

					if (currentDateTime.isAfter(scheduledDateTime)) {
						scheduledTest.setStatus(1); // set as during test
						App.addScheduleTest(scheduledTest);
						Timer timer = new Timer();

						try {
							sendToAllClients(new CustomMessage("timerStarted", scheduledTest));
						}catch (Exception e){
							e.printStackTrace();
						}

						System.out.println("timer started for test : "+ scheduledTest.getId());
						// timer started
						// now we apply what the timer will do through its whole lifecycle
						TimerTask task = new TimerTask() {
							@Override
							public void run() {
								ScheduledTest st = App.getScheduleTest(scheduledTest.getId());
								long timeLimitMinutes = st.getTimeLimit();
								LocalDateTime scheduledDateTime = LocalDateTime.of(st.getDate(), st.getTime());
								LocalDateTime endTime = scheduledDateTime.plusMinutes(timeLimitMinutes);
								LocalDateTime currentDateTime = LocalDateTime.now();
								long timeLeft = Duration.between(currentDateTime,endTime).toMinutes();

								try {
									List<Object> scheduleTestId_timeLeft = new ArrayList<>();
									scheduleTestId_timeLeft.add(st.getId());
									System.out.println("Time Left: " + timeLeft);
									scheduleTestId_timeLeft.add(timeLeft);
									sendToAllClients(new CustomMessage("timeLeft",scheduleTestId_timeLeft));//TODO send also the schedule test for check
								}catch (Exception e){
									e.printStackTrace();
								}

								if (currentDateTime.isAfter(endTime)) {
									System.out.println("current date time " + currentDateTime);
									System.out.println("end time " + endTime);

									System.out.println("checking the time left " + timeLeft);
									try {
										sendToAllClients(new CustomMessage("timerFinished",st));
									}catch (Exception e){
										e.printStackTrace();
									}

									timer.cancel(); // Stop the timer when the time limit is reached
									scheduledTest.setStatus(2);
									App.addScheduleTest(scheduledTest);
									System.out.println("Status "+ scheduledTest.getStatus());
								}
							}
						};

						timer.schedule(task, 0, 10000); // Check every 10 seconds (adjust the delay as needed)
					}
				}
			}
		}, 0, 20, TimeUnit.SECONDS);
	}

	public void scheduleTestTimerHandler(){
		ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
		executorService.scheduleAtFixedRate(new Runnable() { // do this code every 20 seconds
			@Override
			public void run() {
				try {
					scheduledTests = App.getScheduledTestsActive();
				} catch (Exception e) {
					e.printStackTrace();
				}
				LocalDateTime currentDateTime = LocalDateTime.now();
				assert scheduledTests != null;
				for (ScheduledTest scheduledTest : scheduledTests) {
					LocalDateTime scheduledDateTime = LocalDateTime.of(scheduledTest.getDate(), scheduledTest.getTime());
					long timeLimitMinutes = scheduledTest.getTimeLimit();

					LocalDateTime endTime = scheduledDateTime.plusMinutes(timeLimitMinutes);

					if(scheduledTest.getStatus()==1 && currentDateTime.isAfter(endTime)) // test is done but not yet updated in the db
					{
						scheduledTest.setStatus(2);
						App.addScheduleTest(scheduledTest);
					}
					else if(scheduledTest.getStatus()==0) { // before test

						if (currentDateTime.isAfter(scheduledDateTime)) {
							scheduledTest.setStatus(1); // set as during test
							App.addScheduleTest(scheduledTest);
							Timer timer = new Timer();

							try {
								sendToAllClients(new CustomMessage("timerStarted", scheduledTest));
							}catch (Exception e){
								e.printStackTrace();
							}

							System.out.println("timer started for test : "+ scheduledTest.getId());
							// timer started
							// now we apply what the timer will do through its whole lifecycle
							TimerTask task = new TimerTask() {
								@Override
								public void run() {
									ScheduledTest st = App.getScheduleTest(scheduledTest.getId());
									long timeLimitMinutes = st.getTimeLimit();
									LocalDateTime scheduledDateTime = LocalDateTime.of(st.getDate(), st.getTime());
									LocalDateTime endTime = scheduledDateTime.plusMinutes(timeLimitMinutes);
									LocalDateTime currentDateTime = LocalDateTime.now();
									long timeLeft = Duration.between(currentDateTime,endTime).toMinutes();

									try {
										List<Object> scheduleTestId_timeLeft = new ArrayList<>();
										scheduleTestId_timeLeft.add(st.getId());
										System.out.println("Time Left: " + timeLeft);
										scheduleTestId_timeLeft.add(timeLeft);
										sendToAllClients(new CustomMessage("timeLeft",scheduleTestId_timeLeft));//TODO send also the schedule test for check
									}catch (Exception e){
										e.printStackTrace();
									}

									if (currentDateTime.isAfter(endTime)) {
										System.out.println("current date time " + currentDateTime);
										System.out.println("end time " + endTime);

										System.out.println("checking the time left " + timeLeft);
										try {
											sendToAllClients(new CustomMessage("timerFinished",st));
										}catch (Exception e){
											e.printStackTrace();
										}

										timer.cancel(); // Stop the timer when the time limit is reached
										scheduledTest.setStatus(2);
										App.addScheduleTest(scheduledTest);
										System.out.println("Status "+ scheduledTest.getStatus());
									}
								}
							};

							timer.schedule(task, 0, 10000); // Check every 10 seconds (adjust the delay as needed)
						}
					}
				}
			}
		}, 0, 20, TimeUnit.SECONDS);
	}

Replace Anonymous With Lambda il.cshaifasweng.OCSFMediatorExample.server.SimpleServer.scheduleTestTimerHandler.scheduleAtFixedRate.new Runnable with () -> {tryscheduledTests=App.getScheduledTestsActive(); in method public scheduleTestTimerHandler() : void from class il.cshaifasweng.OCSFMediatorExample.server.SimpleServer


    public void updateSelectedListView(){
        selectedQuestionsListView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(Question_Score question, boolean empty) {
                super.updateItem(question, empty);
                if (empty || question == null) {
                    setText(null);
                    setGraphic(null);
                } else {
                    VBox vbox = new VBox();
                    // show question text and score
                    Label questionText = new Label(question.getQuestion().getText());
                    vbox.getChildren().add(questionText);

                    Label score = new Label("( " + question.getScore() + " points )");
                    vbox.getChildren().add(score);

                    setGraphic(vbox);
                }
            }
        });
    }

    public void updateSelectedListView(){
        selectedQuestionsListView.setCellFactory(param -> new ListCell<Question_Score>() {
            @Override
            protected void updateItem(Question_Score question, boolean empty) {
                super.updateItem(question, empty);
                if (empty || question == null) {
                    setText(null);
                    setGraphic(null);
                } else {
                    VBox vbox = new VBox();
                    // show question text and score
                    Label questionText = new Label(question.getQuestion().getText());
                    vbox.getChildren().add(questionText);

                    Label score = new Label("( " + Integer.toString(question.getScore()) + " points )");
                    vbox.getChildren().add(score);

                    setGraphic(vbox);
                }
            }
        });
    }

Replace Generic With Diamond ListCell<Question_Score> with ListCell<> in method public updateSelectedListView() : void from class il.cshaifasweng.OCSFMediatorExample.client.Controllers.CreateExamFormController2


    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onShowScheduleTestEvent(ShowScheduleTestEvent event) {
        try {
            setScheduledTests(event.getScheduledTestList());
            id.setCellValueFactory(new PropertyValueFactory<>("id"));
            date.setCellValueFactory(new PropertyValueFactory<>("date"));
            time.setCellValueFactory(cellData -> {
                String formattedTime = cellData.getValue().getTime().toString();
                formattedTime = formattedTime.substring(0, 5);
                return new SimpleStringProperty(formattedTime);
            });
            submission.setCellValueFactory(new PropertyValueFactory<>("checkedSubmissions" + "/" + "submissions"));
            examFormId.setCellValueFactory(param -> {
                try {

                    return new SimpleStringProperty(param.getValue().getExamForm().getCode());
                } catch (NullPointerException e) {
                    // Handle the exception here (e.g., set a default value)
                    return new SimpleStringProperty("N/A");
                }
            });
            teacherId.setCellValueFactory(param -> {
                try {
                    return new SimpleStringProperty(param.getValue().getTeacher().getId());
                } catch (NullPointerException e) {
                    // Handle the exception here (e.g., set a default value)
                    return new SimpleStringProperty("N/A");
                }
            });
            ShowScheduleTest("ShowAllTests");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onShowScheduleTestEvent(ShowScheduleTestEvent event) {
        try {
            setScheduledTests(event.getScheduledTestList());
            id.setCellValueFactory(new PropertyValueFactory<ScheduledTest, String>("id"));
            date.setCellValueFactory(new PropertyValueFactory<ScheduledTest, String>("date"));
            time.setCellValueFactory(cellData -> {
                String formattedTime = cellData.getValue().getTime().toString();
                formattedTime = formattedTime.substring(0, 5);
                return new SimpleStringProperty(formattedTime);
            });
            submission.setCellValueFactory(new PropertyValueFactory<ScheduledTest, String>("checkedSubmissions" + "/" +"submissions"));
            examFormId.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ScheduledTest, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(TableColumn.CellDataFeatures<ScheduledTest, String> param) {
                    try {

                        return new SimpleStringProperty(param.getValue().getExamForm().getCode());
                    } catch (NullPointerException e) {
                        // Handle the exception here (e.g., set a default value)
                        return new SimpleStringProperty("N/A");
                    }
                }
            });
            teacherId.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ScheduledTest, String>, ObservableValue<String>>() {
                @Override
                public ObservableValue<String> call(TableColumn.CellDataFeatures<ScheduledTest, String> param) {
                    try {
                        return new SimpleStringProperty(param.getValue().getTeacher().getId());
                    } catch (NullPointerException e) {
                        // Handle the exception here (e.g., set a default value)
                        return new SimpleStringProperty("N/A");
                    }
                }
            });
            ShowScheduleTest("ShowAllTests");
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

Replace Anonymous With Lambda il.cshaifasweng.OCSFMediatorExample.client.Controllers.ShowScheduleTestController.onShowScheduleTestEvent.setCellValueFactory.new Callback<TableColumn.CellDataFeatures<ScheduledTest,String>,ObservableValue<String>> with param -> {tryreturn new SimpleStringProperty(param.getValue().getExamForm().getCode()); in method public onShowScheduleTestEvent(event ShowScheduleTestEvent) : void from class il.cshaifasweng.OCSFMediatorExample.client.Controllers.ShowScheduleTestController


    public List<Integer> preorderTraversal0(TreeNode root) {
        List<Integer> res = new ArrayList<>();
        preorder(root, res);
        return res;
    }

    public List<Integer> preorderTraversal0(TreeNode root) {
        List<Integer> res = new ArrayList<Integer>();
        preorder(root, res);
        return res;
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method public preorderTraversal0(root TreeNode) : List<Integer> from class LeetCode.Tree.TreeNode


    public static String httpRequestByPOST() {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        String result = "";
        try {
            // 创建HttpGet对象
            HttpGet httpGet = new HttpGet("http://localhost:8080/greeting");

            // 执行请求

            try (CloseableHttpResponse response = httpClient.execute(httpGet)) {
                // 获取响应实体
                HttpEntity entity = response.getEntity();

                if (entity != null) {
                    // 将响应实体转换为字符串
                    result = EntityUtils.toString(entity);
                    System.out.println("Response: " + result);
                }
            }
        } catch (Exception e) {
            log.info(e.getMessage());
            log.info(e.toString());
        } finally {
            try {
                httpClient.close();
            } catch (Exception e) {
                log.info(e.getMessage());
                log.info(e.toString());
            }
        }
        return result;
    }

    public static String httpRequestByPOST() {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        String result = "";
        try {
            // 创建HttpGet对象
            HttpGet httpGet = new HttpGet("http://localhost:8080/greeting");

            // 执行请求
            CloseableHttpResponse response = httpClient.execute(httpGet);

            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();

                if (entity != null) {
                    // 将响应实体转换为字符串
                    result = EntityUtils.toString(entity);
                    System.out.println("Response: " + result);
                }
            } finally {
                response.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return result;
    }

Try With Resources try(CloseableHttpResponse response=httpClient.execute(httpGet)) in method public httpRequestByPOST() : String from class demo.study.springboot.HttpGetExample


    /**
     *  方法二：获得第一行的 再获得第二行的数据 再通过第二行的获得第三行的 以此类推
     * @param rowIndex 行下标
     * @return 返回行数据
     */
    public List<Integer> getRow1(int rowIndex) {
        List<Integer> row = new ArrayList<>();
        row.add(1);
        for (int i = 1; i <= rowIndex; ++i) {
            row.add(0);
            for (int j = i; j > 0; --j) {
                row.set(j, row.get(j) + row.get(j - 1));
            }
        }
        return row;
    }

    /**
     *  方法二：获得第一行的 再获得第二行的数据 再通过第二行的获得第三行的 以此类推
     * @param rowIndex 行下标
     * @return 返回行数据
     */
    public List<Integer> getRow1(int rowIndex) {
        List<Integer> row = new ArrayList<Integer>();
        row.add(1);
        for (int i = 1; i <= rowIndex; ++i) {
            row.add(0);
            for (int j = i; j > 0; --j) {
                row.set(j, row.get(j) + row.get(j - 1));
            }
        }
        return row;
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method public getRow1(rowIndex int) : List<Integer> from class LeetCode.Solution15


    public static List<User> sortByAllFields(List<User> users) {
        users.sort(Comparator.comparing(User::getName).thenComparingInt(User::getAge));
        return users;
    }

    public static List<User> sortByAllFields(List<User> users) {
        users.sort(new Comparator<User>() {
            @Override
            public int compare(User one, User two) {
                int result = one.getName().compareTo(two.getName());
                return result == 0 ? one.getAge() - two.getAge() : result;
            }
        });
        return users;
    }

Replace Anonymous With Lambda ru.job4j.sort.SortUser.sortByAllFields.sort.new Comparator<User> with User::getName in method public sortByAllFields(users List<User>) : List<User> from class ru.job4j.sort.SortUser


    /**
     * Вспомогательный метод, предназначен для установления существует ли в структуре необходимая таблица.
     */
    public boolean tableExist(Connection connection) {
        boolean result = false;
        if (connection != null) {
            try (ResultSet rs = connection.getMetaData().getTables(null, null, TABLE, null)) {
                while (rs.next()) {
                    if (TABLE.equals(rs.getString("TABLE_NAME"))) {
                        result = true;
                        break;
                    }
                }
            } catch (SQLException exc) {
                logger.error(exc.getMessage(), exc);
            }
            if (!result) {
                try (Statement st = connection.createStatement()) {
                    st.execute("create table items ("
                            + "id serial primary key,"
                            + "name varchar(100) not null"
                            + ");");
                } catch (SQLException exc) {
                    logger.error(exc.getMessage(), exc);
                }
                System.out.println(String.format("Создана таблица %s", TABLE));
                result = true;
            }
        }
        return result;
    }

    /**
     * Вспомогательный метод, предназначен для установления существует ли в структуре необходимая таблица.
     */
    public boolean tableExist(Connection connection) {
        boolean result = false;
        if (connection != null) {
            try {
                ResultSet rs = connection.getMetaData().getTables(null, null, TABLE, null);
                while (rs.next()) {
                    String str = rs.getString("TABLE");
                    if (TABLE.equals(str)) {
                        result = true;
                        break;
                    }
                }
            } catch (SQLException exc) {
                logger.error(exc.getMessage(), exc);
            }
            if (!result) {
                try {
                    Statement st = connection.createStatement();
                    st.execute("create table items ("
                            + "id serial primary key,"
                            + "name varchar(100) not null"
                            + ");");
                } catch (SQLException exc) {
                    logger.error(exc.getMessage(), exc);
                }
                result = true;
            }
        }
        return result;
    }

Try With Resources try(ResultSet rs=connection.getMetaData().getTables(null,null,TABLE,null)) in method public tableExist(connection Connection) : boolean from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для добавления заявки в таблицу базы данных.
     */
    @Override
    public Item add(Item item) {
        Item result = null;
        try (PreparedStatement addSt =
                     connection.prepareStatement("insert into items(name) values (?);");
             PreparedStatement selectSt =
                     connection.prepareStatement("select * from items where name = ?;")) {
            addSt.setString(1, item.getName());
            addSt.executeUpdate();
            selectSt.setString(1, item.getName());
            ResultSet rs = selectSt.executeQuery();
            while (rs.next()) {
                result = new Item(rs.getString("name"));
                result.setId(String.valueOf(rs.getInt("id")));
            }
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

    /**
     * Метод предназначен для добавления заявки в таблицу базы данных.
     */
    @Override
    public Item add(Item item) {
        Item result = null;
        try {
            PreparedStatement addSt = connection.prepareStatement("insert into items(name) values (?);");
            addSt.setString(1, item.getName());
            addSt.executeUpdate();
            PreparedStatement selectSt = connection.prepareStatement("select * from items where name = ?;");
            selectSt.setString(1, item.getName());
            ResultSet rs = selectSt.executeQuery();
            while (rs.next()) {
                result = new Item(rs.getString("name"));
                result.setId(String.valueOf(rs.getInt("id")));
            }
            rs.close();
            selectSt.close();
            addSt.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

Try With Resources try(PreparedStatement addSt=connection.prepareStatement("insert into items(name) values (?);"); PreparedStatement selectSt=connection.prepareStatement("select * from items where name = ?;")) in method public add(item Item) : Item from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для изменения заявки по id.
     * @param id заявки которую необходимо изменить.
     * @param item новая заявка.
     * @return true - заявка изменена.
     */
    @Override
    public boolean replace(String id, Item item) {
        boolean result;
        try (PreparedStatement replaceSt =
                     connection.prepareStatement("update items set name = ? where id = ?;")) {
            replaceSt.setString(1, item.getName());
            replaceSt.setInt(2, Integer.parseInt(id));
            replaceSt.executeUpdate();
            result = true;
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
            result = false;
        }
        return result;
    }

    /**
     * Метод предназначен для изменения заявки по id.
     * @param id заявки которую необходимо изменить.
     * @param item новая заявка.
     * @return true - заявка изменена.
     */
    @Override
    public boolean replace(String id, Item item) {
        boolean result;
        try {
            PreparedStatement replaceSt = connection.prepareStatement("update items set name = ? where id = ?;");
            replaceSt.setString(1, item.getName());
            replaceSt.setInt(2, Integer.parseInt(id));
            replaceSt.executeUpdate();
            result = true;
            replaceSt.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
            result = false;
        }
        return result;
    }

Try With Resources try(PreparedStatement replaceSt=connection.prepareStatement("update items set name = ? where id = ?;")) in method public replace(id String, item Item) : boolean from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для удаления заявки по id.
     * @param id заявки которую необходимо удалить.
     * @return true - заявка удалена.
     */
    @Override
    public boolean delete(String id) {
        boolean result;
        try (PreparedStatement deleteSt = connection.prepareStatement("delete from items where id = ?;")) {
            deleteSt.setInt(1, Integer.parseInt(id));
            deleteSt.executeUpdate();
            result = true;
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
            result = false;
        }
        return result;
    }

    /**
     * Метод предназначен для удаления заявки по id.
     * @param id заявки которую необходимо удалить.
     * @return true - заявка удалена.
     */
    @Override
    public boolean delete(String id) {
        boolean result;
        try {
            PreparedStatement deleteSt = connection.prepareStatement("delete from items where id = ?;");
            deleteSt.setInt(1, Integer.parseInt(id));
            deleteSt.executeUpdate();
            result = true;
            deleteSt.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
            result = false;
        }
        return result;
    }

Try With Resources try(PreparedStatement deleteSt=connection.prepareStatement("delete from items where id = ?;")) in method public delete(id String) : boolean from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для получения списка всех заявок.
     */
    @Override
    public List<Item> findAll() {
        List<Item> result = new ArrayList<>();
        try (Statement st = connection.createStatement()) {
            ResultSet rs = st.executeQuery("select * from items;");
            while (rs.next()) {
                Item it = new Item(rs.getString("name"));
                it.setId(String.valueOf(rs.getInt("id")));
                result.add(it);
            }
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

    /**
     * Метод предназначен для получения списка всех заявок.
     */
    @Override
    public List<Item> findAll() {
        List<Item> result = new ArrayList<>();
        try {
            Statement st = connection.createStatement();
            ResultSet rs = st.executeQuery("select * from items;");
            while (rs.next()) {
                Item it = new Item(rs.getString("name"));
                it.setId(String.valueOf(rs.getInt("id")));
                result.add(it);
            }
            rs.close();
            st.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

Try With Resources try(Statement st=connection.createStatement()) in method public findAll() : List<Item> from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для поиска заявки по имени.
     */
    @Override
    public List<Item> findByName(String key) {
        List<Item> result = new ArrayList<>();
        try (PreparedStatement findByNameSt =
                     connection.prepareStatement("select * from items where name = ?;")) {
            findByNameSt.setString(1, key);
            ResultSet rs = findByNameSt.executeQuery();
            while (rs.next()) {
                Item it = new Item(rs.getString("name"));
                it.setId(String.valueOf(rs.getInt("id")));
                result.add(it);
            }
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

    /**
     * Метод предназначен для поиска заявки по имени.
     */
    @Override
    public List<Item> findByName(String key) {
        List<Item> result = new ArrayList<>();
        try {
            PreparedStatement findByNameSt = connection.prepareStatement("select * from items where name = ?;");
            findByNameSt.setString(1, key);
            ResultSet rs = findByNameSt.executeQuery();
            while (rs.next()) {
                Item it = new Item(rs.getString("name"));
                it.setId(String.valueOf(rs.getInt("id")));
                result.add(it);
            }
            rs.close();
            findByNameSt.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

Try With Resources try(PreparedStatement findByNameSt=connection.prepareStatement("select * from items where name = ?;")) in method public findByName(key String) : List<Item> from class ru.job4j.tracker.TrackerSQL


    /**
     * Метод предназначен для поиска заявки по id.
     */
    @Override
    public Item findById(String id) {
        Item result = null;
        try (PreparedStatement findByIdSt =
                     connection.prepareStatement("select * from items where id = ?;")) {
            findByIdSt.setInt(1, Integer.parseInt(id));
            ResultSet rs = findByIdSt.executeQuery();
            while (rs.next()) {
                result = new Item(rs.getString("name"));
                result.setId(String.valueOf(rs.getInt("id")));
            }
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

    /**
     * Метод предназначен для поиска заявки по id.
     */
    @Override
    public Item findById(String id) {
        Item result = null;
        try {
            PreparedStatement findByIdSt = connection.prepareStatement("select * from items where id = ?;");
            findByIdSt.setInt(1, Integer.parseInt(id));
            ResultSet rs = findByIdSt.executeQuery();
            while (rs.next()) {
                result = new Item(rs.getString("name"));
                result.setId(String.valueOf(rs.getInt("id")));
            }
            rs.close();
            findByIdSt.close();
        } catch (SQLException exc) {
            logger.error(exc.getMessage(), exc);
        }
        return result;
    }

Try With Resources try(PreparedStatement findByIdSt=connection.prepareStatement("select * from items where id = ?;")) in method public findById(id String) : Item from class ru.job4j.tracker.TrackerSQL


    @Override
    public Iterator<E> iterator() {
        Queue<Node<E>> data = new LinkedList<>();
        data.offer(root);
        return new Iterator<>() {
            @Override
            public boolean hasNext() {
                return !data.isEmpty();
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    throw new NoSuchElementException("Collection is empty");
                }
                Node<E> e = data.poll();
                for (Node<E> child : e.leaves()) {
                    data.offer(child);
                }
                return e.getValue();
            }
        };
    }

    @Override
    public Iterator<E> iterator() {
        Queue<Node<E>> data = new LinkedList<>();
        return new Iterator<E>() {
            Node<E> actual = root;
            @Override
            public boolean hasNext() {
                return actual != null;
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                E value = actual.getValue();
                if (!actual.leaves().isEmpty()) {
                    for (Node<E> child : actual.leaves()) {
                        data.offer(child);
                    }
                }
                actual = data.isEmpty() ? null : data.poll();
                return value;
            }
        };
    }

Replace Generic With Diamond Iterator<E> with Iterator<> in method public iterator() : Iterator<E> from class ru.job4j.tree.Tree


    public static void main(String[] args) {

        int[] arr = {1, 4, 5, 3, 7, 3, 9};
        int target = 3;
        ArrayList<Integer> result = findValueIndices(arr, target, 0, new ArrayList<>());
        System.out.println("The value "+target+" is found at indices "+result);
    }

    public static void main(String[] args) {

        int[] arr = {1, 4, 5, 3, 7, 3, 9};
        int target = 3;
        ArrayList<Integer> result = findValueIndices(arr, target, 0, new ArrayList<Integer>());
        System.out.println("The value "+target+" is found at indices "+result);
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method public main(args String[]) : void from class dsa.problems._28_LinearSearch_All_Indexes_Recursion


    public static ArrayList<Integer> createArrayList() {

        ArrayList<Integer> array = new ArrayList<>();
        Random random = new Random();
        int upperbound = 100000;
        for (int i = 1; i <= 100; i++) {
            array.add(random.nextInt(upperbound));
        }
        return array;
    }

    public static ArrayList<Integer> createArrayList() {

        ArrayList<Integer> array = new ArrayList<Integer>();
        Random random = new Random();
        int upperbound = 100000;
        for (int i = 1; i <= 100; i++) {
            array.add(random.nextInt(upperbound));
        }
        return array;
    }

Replace Generic With Diamond ArrayList<Integer> with ArrayList<> in method public createArrayList() : ArrayList<Integer> from class algorithmes.sorts.util.UtilsStudy


    public static LinkedList<Integer> createLinkedList(int size) {

        LinkedList<Integer> list = new LinkedList<>();
        Random random = new Random();
        int upperbound = 100000;
        for (int i = 1; i <= size; i++) {
            list.add(random.nextInt(upperbound));
        }
        return list;
    }

    public static LinkedList<Integer> createLinkedList(int size) {

        LinkedList<Integer> list = new LinkedList<Integer>();
        Random random = new Random();
        int upperbound = 100000;
        for (int i = 1; i <= size; i++) {
            list.add(random.nextInt(upperbound));
        }
        return list;
    }

Replace Generic With Diamond LinkedList<Integer> with LinkedList<> in method public createLinkedList(size int) : LinkedList<Integer> from class algorithmes.sorts.util.UtilsStudy


	public Storage() {
		subscriptions = new ConcurrentHashMap<String, Set<String>>();
		clients = new ConcurrentHashMap<>();
	}

	public Storage() {
		subscriptions = new ConcurrentHashMap<String, Set<String>>();
		clients = new ConcurrentHashMap<String, ClientSession>();
	}

Replace Generic With Diamond ConcurrentHashMap<String,ClientSession> with ConcurrentHashMap<> in method public Storage() from class no.hvl.dat110.broker.Storage


	public Functional<T> filter(FilteringFunction<T> question) {
		List<T> results = new ArrayList<>();
		for (T item : items) {
			if(question.apply(item)){
				results.add(item);
			}
		}
		return new Functional<>(results);
	}

	public Functional<T> filter(FilteringFunction<T> question) {
		List<T> results = new ArrayList<>();
		for (T item : items) {
			if(question.apply(item)){
				results.add(item);
			}
		}
		return new Functional<T>(results);
	}

Replace Generic With Diamond Functional<T> with Functional<> in method public filter(question FilteringFunction<T>) : Functional<T> from class com.codemanship.functional.Functional


	public <R> Functional<R> map(MappingFunction<T, R> function) {
		List<R> results = new ArrayList<>();
		for (T item : items) {
			results.add(function.apply(item));
		}
		return new Functional<>(results);
	}

	public <R> Functional<R> map(MappingFunction<T, R> function) {
		List<R> results = new ArrayList<>();
		for (T item : items) {
			results.add(function.apply(item));
		}
		return new Functional<R>(results);
	}

Replace Generic With Diamond Functional<R> with Functional<> in method public map(function MappingFunction<T,R>) : Functional<R> from class com.codemanship.functional.Functional


	public CompletionServiceHelper(int poolSize) {
		pool = Executors.newFixedThreadPool(poolSize);
		completionService = new ExecutorCompletionService<>(pool);
	}

	public CompletionServiceHelper(int poolSize) {
		pool = Executors.newFixedThreadPool(poolSize);
		completionService = new ExecutorCompletionService<T>(pool);
	}

Replace Generic With Diamond ExecutorCompletionService<T> with ExecutorCompletionService<> in method public CompletionServiceHelper(poolSize int) from class com.ag777.util.lang.thread.CompletionServiceHelper


	public CompletionServiceHelper(ExecutorService pool) {
		this.pool = pool;
		completionService = new ExecutorCompletionService<>(pool);
	}

	public CompletionServiceHelper(ExecutorService pool) {
		this.pool = pool;
		completionService = new ExecutorCompletionService<T>(pool);
	}

Replace Generic With Diamond ExecutorCompletionService<T> with ExecutorCompletionService<> in method public CompletionServiceHelper(pool ExecutorService) from class com.ag777.util.lang.thread.CompletionServiceHelper


	/**
	 * 测试连接
	 * @param timeoutSeconds timeoutSeconds
	 * @return 是否成功
	 */
	public boolean test(int timeoutSeconds) {
		try (Statement stmt = conn.createStatement()) {
			stmt.setQueryTimeout(timeoutSeconds);//单位秒
			return true;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	/**
	 * 测试连接
	 * @param timeoutSeconds timeoutSeconds
	 * @return 是否成功
	 */
	public boolean test(int timeoutSeconds) {
		Statement stmt = null;
		try {
			stmt = conn.createStatement();
			stmt.setQueryTimeout(timeoutSeconds);//单位秒
			return true;
		} catch (SQLException e) {
			e.printStackTrace();
		} finally {
			try {
				if(stmt != null) {
					stmt.close();
				}
			} catch (SQLException e) {
			}
		}
		return false;
	}

Try With Resources try(Statement stmt=conn.createStatement()) in method public test(timeoutSeconds int) : boolean from class com.ag777.util.db.DbHelper


	/**
	 * 构建带进度监听的okhttpBuilder
	 * @param builder builder
	 * @param listener listener
	 * @return OkHttpClient.Builder
	 */
	public static OkHttpClient.Builder builderWithProgress(OkHttpClient.Builder builder, ProgressResponseBody.ProgressListener listener) {
		if(builder == null) {
			builder = client().newBuilder();
		}
		if(listener != null) {
			return builder
		        .addNetworkInterceptor(chain -> {
					Response response = chain.proceed(chain.request());
					//这里将ResponseBody包装成我们的ProgressResponseBody
					return response.newBuilder()
							.body(new ProgressResponseBody(response.body(),listener))
							.build();
				});
		}
		//监听事件和builder都为null则不重构client
		return builder;
	}

	/**
	 * 构建带进度监听的okhttpBuilder
	 * @param builder builder
	 * @param listener listener
	 * @return
	 */
	public static OkHttpClient.Builder builderWithProgress(OkHttpClient.Builder builder, ProgressResponseBody.ProgressListener listener) {
		if(builder == null) {
			builder = client().newBuilder();
		}
		if(listener != null) {
			return builder
		        .addNetworkInterceptor(new Interceptor() {
		            @Override
		            public Response intercept(Chain chain) throws IOException {
		                Response response = chain.proceed(chain.request());
		                //这里将ResponseBody包装成我们的ProgressResponseBody
		                return response.newBuilder()
		                        .body(new ProgressResponseBody(response.body(),listener))
		                        .build();
		            }
		        });
		}
		//监听事件和builder都为null则不重构client
		return builder;
	}

Replace Anonymous With Lambda com.ag777.util.http.HttpUtils.builderWithProgress.addNetworkInterceptor.new Interceptor with chain -> {Response response=chain.proceed(chain.request()); in method public builderWithProgress(builder OkHttpClient.Builder, listener ProgressResponseBody.ProgressListener) : OkHttpClient.Builder from class com.ag777.util.http.HttpUtils


	public SocketServer(ServerSocket server, Handler handler) {
		this.server = server;
		this.port = server.getLocalPort();
		sessionMap = MapUtils.newConcurrentHashMap();
		isRunning = true;
		handler.onSeverCreate(port);
		tg = new ThreadGroup("socket-server");

		while(isRunning){
			try {
	            Socket socket = server.accept();
	            String sessionId = StringUtils.uuid();
	            Session session = new Session(sessionId, socket);
	            /*
	             *连接建立判断是否需要断开连接
	             */
	            if(!handler.onPreConnect(socket, sessionId)) {
	            	IOUtils.close(socket);
	            	continue;
	            }

	            /*
	             * 连接建立后执行
	             */
	            handler.onConnect(socket, sessionId);

	            /*
	             * 允许本次连接新建线程执行处理客户端传来的信息
	             */
	            Thread sessionThread = new Thread(tg, () -> {
					try {
						session.handle(handler);
					} catch(InterruptedException ex) {
						//中断
					} catch (Throwable ex) {
						handler.onErr(socket, sessionId, ex);
					} finally {
						sessionMap.remove(sessionId);
						handler.onDisConnect(socket, sessionId);
					}
				});

				sessionMap.put(session.getId(), session);
	            sessionThread.start();

			} catch(Exception ex) {
				handler.onServerErr(ex);
			}
        }

		IOUtils.close(server);
		handler.onServerDispose(port);
	}

	public SocketServer(ServerSocket server, Handler handler) {
		this.server = server;
		this.port = server.getLocalPort();
		sessionMap = MapUtils.newConcurrentHashMap();
		isRunning = true;
		handler.onSeverCreate(port);

		while(isRunning){
			try {
	            Socket socket = server.accept();
	            String sessionId = StringUtils.uuid();
	            Session session = new Session(sessionId, socket);
	            sessionMap.put(session.getId(), session);
	            /*
	             *连接建立判断是否需要断开连接
	             */
	            if(!handler.onPreConnect(socket, sessionId)) {
	            	IOUtils.close(socket);
	            	continue;
	            }

	            /*
	             * 连接建立后执行
	             */
	            handler.onConnect(socket, sessionId);

	            /*
	             * 允许本次连接新建线程执行处理客户端传来的信息
	             */
	            Thread sessionThread = new Thread(new Runnable() {

					@Override
					public void run() {
						try {
							session.handle(handler);
						} catch (IOException ex) {
							handler.onErr(socket, sessionId, ex);
						} catch(Exception ex) {
							handler.onErr(socket, sessionId, ex);
						} finally {
							sessionMap.remove(sessionId);
							handler.onDisConnect(socket, sessionId);
						}
					}
				});
	            sessionThread.start();

			} catch(Exception ex) {
				handler.onServerErr(ex);
			}
        }

		IOUtils.close(server);
		handler.onServerDispose(port);
	}

Replace Anonymous With Lambda com.ag777.util.lang.socket.SocketServer.SocketServer.sessionThread.new Thread.new Runnable with () -> {trysession.handle(handler); in method public SocketServer(server ServerSocket, handler Handler) from class com.ag777.util.lang.socket.SocketServer


    @Override
    public CommandResult execute(HttpServletRequest request) throws CommandException {
        HashMap<String, Object> attributes = new HashMap<>();
        attributes.put("message", "Hello, World!");
        return new JspResult("hello", attributes);
    }

    @Override
    public CommandResult execute(HttpServletRequest request) throws CommandException {
        var attributes = new HashMap<String, Object>();
        attributes.put("message", "Hello, World!");
        return new JspResult("hello", attributes);
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public execute(request HttpServletRequest) : CommandResult from class by.bsuir.wtlab2.controller.commands.implementations.HelloCommand


    /**
     * Konstruktøren til "Space", med "board", x og y som parametre
     * Sætter player til at være "null", hvilket betyder der ikke befinder sig en spiller på felter/Spacet
     *
     * @param board
     * @param x
     * @param y
     */
    public Space(Board board, int x, int y) {
        this.board = board;
        this.x = x;
        this.y = y;
        this.wallList = new ArrayList<>();
        player = null;
    }

    /**
     * Konstruktøren til "Space", med "board", x og y som parametre
     * Sætter player til at være "null", hvilket betyder der ikke befinder sig en spiller på felter/Spacet
     *
     * @param board
     * @param x
     * @param y
     */
    public Space(Board board, int x, int y) {
        this.board = board;
        this.x = x;
        this.y = y;
        this.wallList = new ArrayList<Heading>();
        player = null;
    }

Replace Generic With Diamond ArrayList<Heading> with ArrayList<> in method public Space(board Board, x int, y int) from class dk.dtu.compute.se.pisd.roborally.model.Space


    /**
     * Creates a new game by creating a board, gamecontroller, players, view. Also starts the programming phase.
     * Also IRepository to create a game in DB.
     */

    public void newGame() {
        playerColors= new  LinkedList<>(Arrays.asList("Crimson", "CornflowerBlue", "PaleVioletRed", "PapayaWhip", "PLUM", "DarkCyan", "DarkGoldenRod", "DarkKhaki", "DarkMagenta", "DeepPink", "Coral"));

        String gameName = choseGameName();
            if(gameName==null) return;
        String gameBoard = choseBoard();
            if(gameBoard==null) return;
        Integer no = chosePlayerCount();
            if(no==null) return;

        Board board = LoadBoard.loadBoard(gameBoard);
        board.setGameName(gameName);
        gameController = new GameController(board);

        for (int i = 0; i < no; i++) {
                String name = chosePlayerName();
                if(name == null) {
                    gameController=null;
                    return;
                }

                String color = choseColor(name);
                if(color == null) {
                    gameController=null;
                    return;
                 }

                Player player = new Player(board, color, name);
                board.addPlayer(player);
                player.setSpace(board.getRebootSpaceList().get(i));
                player.setRebootSpace(board.getRebootSpaceList().get(i));
            }

            gameController.startProgrammingPhase();

            IRepository repository = RepositoryAccess.getRepository();
            repository.createGameInDB(board);

            roboRally.createBoardView(gameController);
    }

    /**
     * Creates a new game by creating a board, gamecontroller, players, view. Also starts the programming phase.
     * Also IRepository to create a game in DB.
     */

    public void newGame() {
        playerColors= new  LinkedList<String>(Arrays.asList("Crimson", "CornflowerBlue", "PaleVioletRed", "PapayaWhip", "PLUM", "DarkCyan", "DarkGoldenRod", "DarkKhaki", "DarkMagenta", "DeepPink", "Coral"));

        String gameName = choseGameName();
            if(gameName==null) return;
        String gameBoard = choseBoard();
            if(gameBoard==null) return;
        Integer no = chosePlayerCount();
            if(no==null) return;

        Board board = LoadBoard.loadBoard(gameBoard);
        board.setGameName(gameName);
        gameController = new GameController(board);

        for (int i = 0; i < no; i++) {
                String name = chosePlayerName();
                if(name == null) {
                    gameController=null;
                    return;
                }

                String color = choseColor(name);
                if(color == null) {
                    gameController=null;
                    return;
                 }

                Player player = new Player(board, color, name);
                board.addPlayer(player);
                player.setSpace(board.getRebootSpaceList().get(i));
                player.setRebootSpace(board.getRebootSpaceList().get(i));
            }

            gameController.startProgrammingPhase();

            IRepository repository = RepositoryAccess.getRepository();
            repository.createGameInDB(board);

            roboRally.createBoardView(gameController);
    }

Replace Generic With Diamond LinkedList<String> with LinkedList<> in method public newGame() : void from class dk.dtu.compute.se.pisd.roborally.controller.AppController


    public void add(T value) {
        Node<T> node = new Node<>(value, null);
        if (head == null) {
            head = node;
            return;
        }
        Node<T> tail = head;
        while (tail.next != null) {
            tail = tail.next;
        }
        tail.next = node;
    }

    public void add(T value) {
        Node<T> node = new Node<T>(value, null);
        if (head == null) {
            head = node;
            return;
        }
        Node<T> tail = head;
        while (tail.next != null) {
            tail = tail.next;
        }
        tail.next = node;
    }

Replace Generic With Diamond Node<T> with Node<> in method public add(value T) : void from class ru.job4j.collection.ForwardLinked


    @Override
    public Iterator<T> iterator() {
        return new Iterator<>() {
            private Node<T> node = head;

            @Override
            public boolean hasNext() {
                return node != null;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                T value = node.value;
                node = node.next;
                return value;
            }
        };
    }

    @Override
    public Iterator<T> iterator() {
        return new Iterator<T>() {
           private Node<T> node = head;

            @Override
            public boolean hasNext() {
                return node != null;
            }

            @Override
            public T next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                T value = node.value;
                node = node.next;
                return value;
            }
        };
    }

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


    @Override
    public Iterator<E> iterator() {
        return new Iterator<>() {
            private final int expectedModCount = modCount;
            private Node<E> cursor = first;

            @Override
            public boolean hasNext() {
                if (expectedModCount != modCount) {
                    throw new ConcurrentModificationException();
                }
                return cursor != null;
            }

            @Override
            public E next() {
                if (!hasNext()) {
                    throw new NoSuchElementException();
                }
                E rsl = cursor.item;
                cursor = cursor.next;
                return rsl;
            }
        };
    }

        @Override
        public Iterator<E> iterator() {
            return new Iterator<E>() {
                private Node<E> result = first;
                private final int expectedModCount = modCount;
                @Override
                public boolean hasNext() {
                    if (expectedModCount != modCount) {
                        throw new ConcurrentModificationException();
                    }
                    return result != null;
                }

                @Override
                public E next() {
                    if (!hasNext()) {
                        throw new NoSuchElementException();
                    }
                     E value = result.item;
                     result = result.next;
                     return value;
                }
            };
        }

Replace Generic With Diamond Iterator<E> with Iterator<> in method public iterator() : Iterator<E> from class ru.job4j.collection.LinkedListSimple


  public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){
    List<Pair> params = new ArrayList<>();

    // preconditions
    if (name == null || name.isEmpty() || value == null) return params;

    Collection valueCollection;
    if (value instanceof Collection) {
      valueCollection = (Collection) value;
    } else {
      params.add(new Pair(name, parameterToString(value)));
      return params;
    }

    if (valueCollection.isEmpty()){
      return params;
    }

    // get the collection format (default: csv)
    String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat);

    // create the params based on the collection format
    if ("multi".equals(format)) {
      for (Object item : valueCollection) {
        params.add(new Pair(name, parameterToString(item)));
      }

      return params;
    }

    String delimiter = ",";

    if ("csv".equals(format)) {
      delimiter = ",";
    } else if ("ssv".equals(format)) {
      delimiter = " ";
    } else if ("tsv".equals(format)) {
      delimiter = "\t";
    } else if ("pipes".equals(format)) {
      delimiter = "|";
    }

    StringBuilder sb = new StringBuilder() ;
    for (Object item : valueCollection) {
      sb.append(delimiter);
      sb.append(parameterToString(item));
    }

    params.add(new Pair(name, sb.substring(1)));

    return params;
  }

  public List<Pair> parameterToPairs(String collectionFormat, String name, Object value){
    List<Pair> params = new ArrayList<Pair>();

    // preconditions
    if (name == null || name.isEmpty() || value == null) return params;

    Collection valueCollection;
    if (value instanceof Collection) {
      valueCollection = (Collection) value;
    } else {
      params.add(new Pair(name, parameterToString(value)));
      return params;
    }

    if (valueCollection.isEmpty()){
      return params;
    }

    // get the collection format (default: csv)
    String format = (collectionFormat == null || collectionFormat.isEmpty() ? "csv" : collectionFormat);

    // create the params based on the collection format
    if ("multi".equals(format)) {
      for (Object item : valueCollection) {
        params.add(new Pair(name, parameterToString(item)));
      }

      return params;
    }

    String delimiter = ",";

    if ("csv".equals(format)) {
      delimiter = ",";
    } else if ("ssv".equals(format)) {
      delimiter = " ";
    } else if ("tsv".equals(format)) {
      delimiter = "\t";
    } else if ("pipes".equals(format)) {
      delimiter = "|";
    }

    StringBuilder sb = new StringBuilder() ;
    for (Object item : valueCollection) {
      sb.append(delimiter);
      sb.append(parameterToString(item));
    }

    params.add(new Pair(name, sb.substring(1)));

    return params;
  }

Replace Generic With Diamond ArrayList<Pair> with ArrayList<> in method public parameterToPairs(collectionFormat String, name String, value Object) : List<Pair> from class org.openapitools.client.ApiClient


    ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
      modelClass = cls;
      discriminatorName = propertyName;
      discriminatorMappings = new HashMap<>();
      if (mappings != null) {
        discriminatorMappings.putAll(mappings);
      }
    }

    ClassDiscriminatorMapping(Class<?> cls, String propertyName, Map<String, Class<?>> mappings) {
      modelClass = cls;
      discriminatorName = propertyName;
      discriminatorMappings = new HashMap<String, Class<?>>();
      if (mappings != null) {
        discriminatorMappings.putAll(mappings);
      }
    }

Replace Generic With Diamond HashMap<String,Class<?>> with HashMap<> in method package ClassDiscriminatorMapping(cls Class<?>, propertyName String, mappings Map<String,Class<?>>) from class org.openapitools.client.JSON.ClassDiscriminatorMapping


  /**
   * Returns the target model class that should be used to deserialize the input data.
   * The discriminator mappings are used to determine the target model class.
   *
   * @param node The input data.
   * @param modelClass The class that contains the discriminator mappings.
   */
  public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
    ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
    if (cdm != null) {
      return cdm.getClassForElement(node, new HashSet<>());
    }
    return null;
  }

  /**
   * Returns the target model class that should be used to deserialize the input data.
   * The discriminator mappings are used to determine the target model class.
   *
   * @param node The input data.
   * @param modelClass The class that contains the discriminator mappings.
   */
  public static Class<?> getClassForElement(JsonNode node, Class<?> modelClass) {
    ClassDiscriminatorMapping cdm = modelDiscriminators.get(modelClass);
    if (cdm != null) {
      return cdm.getClassForElement(node, new HashSet<Class<?>>());
    }
    return null;
  }

Replace Generic With Diamond HashSet<Class<?>> with HashSet<> in method public getClassForElement(node JsonNode, modelClass Class<?>) : Class<?> from class org.openapitools.client.JSON


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesAnyType putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : AdditionalPropertiesAnyType from class org.openapitools.client.model.AdditionalPropertiesAnyType


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesArray putAdditionalProperty(String key, List value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesArray putAdditionalProperty(String key, List value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, List>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,List> with HashMap<> in method public putAdditionalProperty(key String, value List) : AdditionalPropertiesArray from class org.openapitools.client.model.AdditionalPropertiesArray


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesBoolean putAdditionalProperty(String key, Boolean value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesBoolean putAdditionalProperty(String key, Boolean value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Boolean>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Boolean> with HashMap<> in method public putAdditionalProperty(key String, value Boolean) : AdditionalPropertiesBoolean from class org.openapitools.client.model.AdditionalPropertiesBoolean


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesInteger putAdditionalProperty(String key, Integer value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesInteger putAdditionalProperty(String key, Integer value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Integer>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Integer> with HashMap<> in method public putAdditionalProperty(key String, value Integer) : AdditionalPropertiesInteger from class org.openapitools.client.model.AdditionalPropertiesInteger


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesNumber putAdditionalProperty(String key, BigDecimal value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesNumber putAdditionalProperty(String key, BigDecimal value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, BigDecimal>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,BigDecimal> with HashMap<> in method public putAdditionalProperty(key String, value BigDecimal) : AdditionalPropertiesNumber from class org.openapitools.client.model.AdditionalPropertiesNumber


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesObject putAdditionalProperty(String key, Map value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesObject putAdditionalProperty(String key, Map value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Map>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Map> with HashMap<> in method public putAdditionalProperty(key String, value Map) : AdditionalPropertiesObject from class org.openapitools.client.model.AdditionalPropertiesObject


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesString putAdditionalProperty(String key, String value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public AdditionalPropertiesString putAdditionalProperty(String key, String value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, String>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public putAdditionalProperty(key String, value String) : AdditionalPropertiesString from class org.openapitools.client.model.AdditionalPropertiesString


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Cat putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Cat putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : Cat from class org.openapitools.client.model.Cat


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public ChildCat putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public ChildCat putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : ChildCat from class org.openapitools.client.model.ChildCat


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public ComplexQuadrilateral putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public ComplexQuadrilateral putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : ComplexQuadrilateral from class org.openapitools.client.model.ComplexQuadrilateral


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Dog putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Dog putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : Dog from class org.openapitools.client.model.Dog


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Drawing putAdditionalProperty(String key, Fruit value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Drawing putAdditionalProperty(String key, Fruit value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Fruit>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Fruit> with HashMap<> in method public putAdditionalProperty(key String, value Fruit) : Drawing from class org.openapitools.client.model.Drawing


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public EquilateralTriangle putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public EquilateralTriangle putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : EquilateralTriangle from class org.openapitools.client.model.EquilateralTriangle


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Mammal putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public Mammal putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : Mammal from class org.openapitools.client.model.Mammal


  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public NullableClass putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

  /**
   * Set the additional (undeclared) property with the specified name and value.
   * If the property does not already exist, create it otherwise replace it.
   */
  @JsonAnySetter
  public NullableClass putAdditionalProperty(String key, Object value) {
    if (this.additionalProperties == null) {
        this.additionalProperties = new HashMap<String, Object>();
    }
    this.additionalProperties.put(key, value);
    return this;
  }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public putAdditionalProperty(key String, value Object) : NullableClass from class org.openapitools.client.model.NullableClass