	@Override
	protected Task<Boolean> createTask() {
		return new Task<>() {

			@Override
			protected Boolean call() throws Exception {
				boolean success = true;

				try {

					// Run on JavaFX Thread
					Platform.runLater(
							() -> xPlayerController.getWaveProgressLabel().setText("Generating Wave Spectrum..."));

					// Calculate
					if (waveFormJob == WaveFormJob.AMPLITUDES_AND_WAVEFORM) { // AMPLITUDES_AND_AMPLITUDES
						System.out.println("AMPLITUDES_AND_AMPLITUDES");
						String fileFormat = "mp3";
						resultingWaveform = processFromNoWavFile(fileFormat);

					} else if (waveFormJob == WaveFormJob.WAVEFORM) { // WAVEFORM
						resultingWaveform = processAmplitudes(wavAmplitudes);
					}
				} catch (Exception ex) {
					ex.printStackTrace();

					// Show not enough disk space error
					if (ex.getMessage().contains("There is not enough space on the disk"))
						AlertTool.showNotification("Error",
								"There is not enough space on the disk \n to create Wave Form Visualization",
								Duration.seconds(3), NotificationType.ERROR);

					return false;
				}

				return true;

			}

			/**
			 * Try to process a Non Wav File
			 *
			 * @param fileFormat
			 * @return
			 * @throws IOException
			 * @throws UnsupportedAudioFileException
			 * @throws EncoderException
			 */
			private float[] processFromNoWavFile(String fileFormat)
					throws IOException, UnsupportedAudioFileException, EncoderException {
				int randomN = random.nextInt(99999);

				// Create temporary files
				String title = IOInfo.getFileTitle(fileAbsolutePath);
				File temporalDecodedFile = File.createTempFile("decoded_" + title + randomN, ".wav");
				File temporalCopiedFile = File.createTempFile("original_" + title + randomN, "." + fileFormat);
				temp1 = temporalDecodedFile;
				temp2 = temporalCopiedFile;

				// Delete temporary Files on exit
				temporalDecodedFile.deleteOnExit();
				temporalCopiedFile.deleteOnExit();

				// Create a temporary path
				Files.copy(new File(fileAbsolutePath).toPath(), temporalCopiedFile.toPath(), options);

				// Transcode to .wav
				if (!transcodeToWav(temporalCopiedFile, temporalDecodedFile))
					return null;

				// Avoid creating amplitudes again for the same file
				if (wavAmplitudes == null)
					wavAmplitudes = getWavAmplitudes(temporalDecodedFile);

				// Delete temporary files
				temporalDecodedFile.delete();
				temporalCopiedFile.delete();

				return processAmplitudes(wavAmplitudes);
			}

			/**
			 * Get Wav Amplitudes
			 *
			 * @param file
			 * @return
			 * @throws UnsupportedAudioFileException
			 * @throws IOException
			 */
			private int[] getWavAmplitudes(File file) throws UnsupportedAudioFileException, IOException {

				// Get Audio input stream
				try (AudioInputStream input = AudioSystem.getAudioInputStream(file)) {
					AudioFormat baseFormat = input.getFormat();

					// Encoding
					Encoding encoding = AudioFormat.Encoding.PCM_UNSIGNED;
					float sampleRate = baseFormat.getSampleRate();
					int numChannels = baseFormat.getChannels();

					AudioFormat decodedFormat = new AudioFormat(encoding, sampleRate, 16, numChannels, numChannels * 2,
							sampleRate, false);
					int available = input.available();

					// Get the PCM Decoded Audio Input Stream
					try (AudioInputStream pcmDecodedInput = AudioSystem.getAudioInputStream(decodedFormat, input)) {
						final int BUFFER_SIZE = 4096; // this is actually bytes

						// Create a buffer
						byte[] buffer = new byte[BUFFER_SIZE];

						// Now get the average to a smaller array
						int maximumArrayLength = 100000;
						int[] finalAmplitudes = new int[maximumArrayLength];
						int samplesPerPixel = available / maximumArrayLength;

						// Variables to calculate finalAmplitudes array
						int currentSampleCounter = 0;
						int arrayCellPosition = 0;
						float currentCellValue = 0.0f;

						// Variables for the loop
						int arrayCellValue = 0;

						// Read all the available data on chunks
						while (pcmDecodedInput.readNBytes(buffer, 0, BUFFER_SIZE) > 0)
							for (int i = 0; i < buffer.length - 1; i += 2) {

								// Calculate the value
								arrayCellValue = (int) (((((buffer[i + 1] << 8) | buffer[i] & 0xff) << 16) / 32767)
										* WAVEFORM_HEIGHT_COEFFICIENT);

								// Every time you him [currentSampleCounter=samplesPerPixel]
								if (currentSampleCounter != samplesPerPixel) {
									++currentSampleCounter;
									currentCellValue += Math.abs(arrayCellValue);
								} else {
									// Avoid ArrayIndexOutOfBoundsException
									if (arrayCellPosition != maximumArrayLength)
										finalAmplitudes[arrayCellPosition] = finalAmplitudes[arrayCellPosition
												+ 1] = (int) currentCellValue / samplesPerPixel;

									// Fix the variables
									currentSampleCounter = 0;
									currentCellValue = 0;
									arrayCellPosition += 2;
								}
							}

						return finalAmplitudes;
					} catch (Exception ex) {
						ex.printStackTrace();
					}
				} catch (Exception ex) {
					ex.printStackTrace();

				}

				// You don't want this to reach here...
				return new int[1];
			}

			/**
			 * Process the amplitudes
			 *
			 * @param sourcePcmData
			 * @return An array with amplitudes
			 */
			private float[] processAmplitudes(int[] sourcePcmData) {

				// The width of the resulting waveform panel
				int width = xPlayerController.getWaveFormVisualization().width;
				float[] waveData = new float[width];
				// Check if null
				if (sourcePcmData == null)
					return waveData;
				int samplesPerPixel = sourcePcmData.length / width;

				// Calculate
				float nValue;
				for (int w = 0; w < width; w++) {

					// For performance keep it here
					int c = w * samplesPerPixel;
					nValue = 0.0f;

					// Keep going
					for (int s = 0; s < samplesPerPixel; s++) {
						nValue += (Math.abs(sourcePcmData[c + s]) / 65536.0f);
					}

					// Set WaveData
					waveData[w] = nValue / samplesPerPixel;
				}

				return waveData;
			}

			/**
			 * Transcode to Wav
			 *
			 * @param sourceFile
			 * @param destinationFile
			 * @throws EncoderException
			 */
			private boolean transcodeToWav(File sourceFile, File destinationFile) throws EncoderException {
				try {

					// Set Audio Attributes
					AudioAttributes audio = new AudioAttributes();
					audio.setCodec("pcm_s16le");
					audio.setChannels(2);
					audio.setSamplingRate(44100);

					// Set encoding attributes
					EncodingAttributes attributes = new EncodingAttributes();
					attributes.setFormat("wav");
					attributes.setAudioAttributes(audio);

					// Abort Encoding
					if (encoder != null)
						encoder.abortEncoding();

					// Encode
					encoder = encoder != null ? encoder : new Encoder();
					encoder.encode(new MultimediaObject(sourceFile), destinationFile, attributes, listener);
				} catch (Exception ex) {
					ex.printStackTrace();
					return false;
				}

				return true;
			}

		};
	}

	@Override
	protected Task<Boolean> createTask() {
		return new Task<Boolean>() {

			@Override
			protected Boolean call() throws Exception {
				boolean success = true;

				try {

					// Run on JavaFX Thread
					Platform.runLater(
							() -> xPlayerController.getWaveProgressLabel().setText("Generating Wave Spectrum..."));

					// Calculate
					if (waveFormJob == WaveFormJob.AMPLITUDES_AND_WAVEFORM) { // AMPLITUDES_AND_AMPLITUDES
						System.out.println("AMPLITUDES_AND_AMPLITUDES");
						String fileFormat = "mp3";
						resultingWaveform = processFromNoWavFile(fileFormat);

					} else if (waveFormJob == WaveFormJob.WAVEFORM) { // WAVEFORM
						resultingWaveform = processAmplitudes(wavAmplitudes);
					}
				} catch (Exception ex) {
					ex.printStackTrace();

					// Show not enough disk space error
					if (ex.getMessage().contains("There is not enough space on the disk"))
						AlertTool.showNotification("Error",
								"There is not enough space on the disk \n to create Wave Form Visualization",
								Duration.seconds(3), NotificationType.ERROR);

					return false;
				}

				return true;

			}

			/**
			 * Try to process a Non Wav File
			 *
			 * @param fileFormat
			 * @return
			 * @throws IOException
			 * @throws UnsupportedAudioFileException
			 * @throws EncoderException
			 */
			private float[] processFromNoWavFile(String fileFormat)
					throws IOException, UnsupportedAudioFileException, EncoderException {
				int randomN = random.nextInt(99999);

				// Create temporary files
				String title = IOInfo.getFileTitle(fileAbsolutePath);
				File temporalDecodedFile = File.createTempFile("decoded_" + title + randomN, ".wav");
				File temporalCopiedFile = File.createTempFile("original_" + title + randomN, "." + fileFormat);
				temp1 = temporalDecodedFile;
				temp2 = temporalCopiedFile;

				// Delete temporary Files on exit
				temporalDecodedFile.deleteOnExit();
				temporalCopiedFile.deleteOnExit();

				// Create a temporary path
				Files.copy(new File(fileAbsolutePath).toPath(), temporalCopiedFile.toPath(), options);

				// Transcode to .wav
				if (!transcodeToWav(temporalCopiedFile, temporalDecodedFile))
					return null;

				// Avoid creating amplitudes again for the same file
				if (wavAmplitudes == null)
					wavAmplitudes = getWavAmplitudes(temporalDecodedFile);

				// Delete temporary files
				temporalDecodedFile.delete();
				temporalCopiedFile.delete();

				return processAmplitudes(wavAmplitudes);
			}

			/**
			 * Get Wav Amplitudes
			 *
			 * @param file
			 * @return
			 * @throws UnsupportedAudioFileException
			 * @throws IOException
			 */
			private int[] getWavAmplitudes(File file) throws UnsupportedAudioFileException, IOException {

				// Get Audio input stream
				try (AudioInputStream input = AudioSystem.getAudioInputStream(file)) {
					AudioFormat baseFormat = input.getFormat();

					// Encoding
					Encoding encoding = AudioFormat.Encoding.PCM_UNSIGNED;
					float sampleRate = baseFormat.getSampleRate();
					int numChannels = baseFormat.getChannels();

					AudioFormat decodedFormat = new AudioFormat(encoding, sampleRate, 16, numChannels, numChannels * 2,
							sampleRate, false);
					int available = input.available();

					// Get the PCM Decoded Audio Input Stream
					try (AudioInputStream pcmDecodedInput = AudioSystem.getAudioInputStream(decodedFormat, input)) {
						final int BUFFER_SIZE = 4096; // this is actually bytes

						// Create a buffer
						byte[] buffer = new byte[BUFFER_SIZE];

						// Now get the average to a smaller array
						int maximumArrayLength = 100000;
						int[] finalAmplitudes = new int[maximumArrayLength];
						int samplesPerPixel = available / maximumArrayLength;

						// Variables to calculate finalAmplitudes array
						int currentSampleCounter = 0;
						int arrayCellPosition = 0;
						float currentCellValue = 0.0f;

						// Variables for the loop
						int arrayCellValue = 0;

						// Read all the available data on chunks
						while (pcmDecodedInput.readNBytes(buffer, 0, BUFFER_SIZE) > 0)
							for (int i = 0; i < buffer.length - 1; i += 2) {

								// Calculate the value
								arrayCellValue = (int) (((((buffer[i + 1] << 8) | buffer[i] & 0xff) << 16) / 32767)
										* WAVEFORM_HEIGHT_COEFFICIENT);

								// Every time you him [currentSampleCounter=samplesPerPixel]
								if (currentSampleCounter != samplesPerPixel) {
									++currentSampleCounter;
									currentCellValue += Math.abs(arrayCellValue);
								} else {
									// Avoid ArrayIndexOutOfBoundsException
									if (arrayCellPosition != maximumArrayLength)
										finalAmplitudes[arrayCellPosition] = finalAmplitudes[arrayCellPosition
												+ 1] = (int) currentCellValue / samplesPerPixel;

									// Fix the variables
									currentSampleCounter = 0;
									currentCellValue = 0;
									arrayCellPosition += 2;
								}
							}

						return finalAmplitudes;
					} catch (Exception ex) {
						ex.printStackTrace();
					}
				} catch (Exception ex) {
					ex.printStackTrace();

				}

				// You don't want this to reach here...
				return new int[1];
			}

			/**
			 * Process the amplitudes
			 *
			 * @param sourcePcmData
			 * @return An array with amplitudes
			 */
			private float[] processAmplitudes(int[] sourcePcmData) {

				// The width of the resulting waveform panel
				int width = xPlayerController.getWaveFormVisualization().width;
				float[] waveData = new float[width];
				// Check if null
				if (sourcePcmData == null)
					return waveData;
				int samplesPerPixel = sourcePcmData.length / width;

				// Calculate
				float nValue;
				for (int w = 0; w < width; w++) {

					// For performance keep it here
					int c = w * samplesPerPixel;
					nValue = 0.0f;

					// Keep going
					for (int s = 0; s < samplesPerPixel; s++) {
						nValue += (Math.abs(sourcePcmData[c + s]) / 65536.0f);
					}

					// Set WaveData
					waveData[w] = nValue / samplesPerPixel;
				}

				return waveData;
			}

			/**
			 * Transcode to Wav
			 *
			 * @param sourceFile
			 * @param destinationFile
			 * @throws EncoderException
			 */
			private boolean transcodeToWav(File sourceFile, File destinationFile) throws EncoderException {
				try {

					// Set Audio Attributes
					AudioAttributes audio = new AudioAttributes();
					audio.setCodec("pcm_s16le");
					audio.setChannels(2);
					audio.setSamplingRate(44100);

					// Set encoding attributes
					EncodingAttributes attributes = new EncodingAttributes();
					attributes.setFormat("wav");
					attributes.setAudioAttributes(audio);

					// Abort Encoding
					if (encoder != null)
						encoder.abortEncoding();

					// Encode
					encoder = encoder != null ? encoder : new Encoder();
					encoder.encode(new MultimediaObject(sourceFile), destinationFile, attributes, listener);
				} catch (Exception ex) {
					ex.printStackTrace();
					return false;
				}

				return true;
			}

		};
	}

Replace Generic With Diamond Task<Boolean> with Task<> in method protected createTask() : Task<Boolean> from class com.goxr3plus.xr3player.xplayer.waveform.WaveFormService


	@Override
	protected Task<Boolean> createTask() {
		return new Task<>() {
			@Override
			protected Boolean call() throws Exception {
				boolean succeded = true;

				// ----------------------- Seek the Media
				updateMessage(!xPlayerController.speedIncreaseWorking ? "Going to : [ "
					+ TimeTool.getTimeEdited(xPlayerController.xPlayerModel.getCurrentAngleTime()) + " ]"
					: "Speed Level : x" + InfoTool
					.getMinString(String.valueOf(xPlayerController.xPlayer.getSpeedFactor()), 4, ""));

				// Stop?
				if (stopPlayer)
					xPlayerController.xPlayer.stop();

				// GO
				// if (bytes != 0) { // and xPlayer.isPausedOrPlaying())
				Main.logger.info("Seek Service Started..");

				// CurrentTime
				xPlayerController.xPlayerModel
					.setCurrentTime(xPlayerController.xPlayerModel.getCurrentAngleTime());

				try {
					xPlayerController.xPlayer.seekBytes(bytesToSkip);
				} catch (final StreamPlayerException ex) {
					xPlayerController.logger.log(Level.WARNING, "", ex);
					succeded = false;
				}
				// }

				// ----------------------- Play Audio
				if (!xPlayerController.xPlayer.isPausedOrPlaying()) {
					xPlayerController.xPlayer.play();
					// xPlayer.pause();
				}

				// ----------------------- Configuration
				updateMessage("Applying Settings ...");

				// Configure Media Settings
				if (xPlayerController.xPlayer.isPausedOrPlaying())
					xPlayerController.configureMediaSettings(true);

				return succeded;
			}

		};
	}

	@Override
	protected Task<Boolean> createTask() {
		return new Task<Boolean>() {
			@Override
			protected Boolean call() throws Exception {
				boolean succeded = true;

				// ----------------------- Seek the Media
				updateMessage(!xPlayerController.speedIncreaseWorking ? "Going to : [ "
					+ TimeTool.getTimeEdited(xPlayerController.xPlayerModel.getCurrentAngleTime()) + " ]"
					: "Speed Level : x" + InfoTool
					.getMinString(String.valueOf(xPlayerController.xPlayer.getSpeedFactor()), 4, ""));

				// Stop?
				if (stopPlayer)
					xPlayerController.xPlayer.stop();

				// GO
				// if (bytes != 0) { // and xPlayer.isPausedOrPlaying())
				Main.logger.info("Seek Service Started..");

				// CurrentTime
				xPlayerController.xPlayerModel
					.setCurrentTime(xPlayerController.xPlayerModel.getCurrentAngleTime());

				try {
					xPlayerController.xPlayer.seekBytes(bytesToSkip);
				} catch (final StreamPlayerException ex) {
					xPlayerController.logger.log(Level.WARNING, "", ex);
					succeded = false;
				}
				// }

				// ----------------------- Play Audio
				if (!xPlayerController.xPlayer.isPausedOrPlaying()) {
					xPlayerController.xPlayer.play();
					// xPlayer.pause();
				}

				// ----------------------- Configuration
				updateMessage("Applying Settings ...");

				// Configure Media Settings
				if (xPlayerController.xPlayer.isPausedOrPlaying())
					xPlayerController.configureMediaSettings(true);

				return succeded;
			}

		};
	}

Replace Generic With Diamond Task<Boolean> with Task<> in method protected createTask() : Task<Boolean> from class com.goxr3plus.xr3player.services.xplayer.XPlayerSeekService


	public static void mediaRename(String oldFilePath, String newFilePath) {

		// Inform all Libraries SmartControllers
		Main.libraryMode.viewer.getItemsObservableList().stream()
			.map(library -> ((Library) library).getSmartController())
			.forEach(smartController -> {

				internalDataBaseRename(smartController, newFilePath, oldFilePath);

			});

		// Inform all XPlayers SmartControllers
		Main.xPlayersList.getList().stream().map(
			xPlayerController -> xPlayerController.getxPlayerPlayList().getSmartController())
			.forEach(smartController -> {

				internalDataBaseRename(smartController, newFilePath, oldFilePath);

			});

		// Update Emotion Lists SmartControllers
		Main.emotionsTabPane.getTabPane().getTabs().stream()
			.map(tab -> (SmartController) tab.getContent()).forEach(smartController -> {

			internalDataBaseRename(smartController, newFilePath, oldFilePath);

		});

		// Inform all XPlayers Models
		Main.xPlayersList.getList().forEach(xPlayerController -> {
			if (oldFilePath.equals(xPlayerController.xPlayerModel.songPathProperty().get())) {

				// filePath
				xPlayerController.xPlayerModel.songPathProperty().set(newFilePath);

				// object
				xPlayerController.playService.checkAudioTypeAndUpdateXPlayerModel(newFilePath);

				// change the text of Marquee
				xPlayerController.mediaFileMarquee.setText(IOInfo.getFileName(newFilePath));

			}
		});

		// Inform Played Media List
		Main.playedSongs.renameMedia(oldFilePath, newFilePath, false);

		// Inform Hated Media List
		Main.emotionListsController.hatedMediaList.renameMedia(oldFilePath, newFilePath, false);
		// Inform Disliked Media List
		Main.emotionListsController.dislikedMediaList.renameMedia(oldFilePath, newFilePath, false);
		// Inform Liked Media List
		Main.emotionListsController.likedMediaList.renameMedia(oldFilePath, newFilePath, false);
		// Inform Loved Media List
		Main.emotionListsController.lovedMediaList.renameMedia(oldFilePath, newFilePath, false);

		// Update the SearchWindow
		Main.searchWindowSmartController.getItemsObservableList().forEach(media -> {
			if (media.getFilePath().equals(oldFilePath))
				media.setFilePath(newFilePath);
		});

	}

	/**
	 * Rename the Media File.
	 *
	 * @param node       The node based on which the Rename Window will be position
	 *                   [[SuppressWarningsSpartan]]
	 */
	public void rename(final Node node) {

		// If !Controller is Locked
		// if (controller.isFree(true)) {

		// Security Variable
		// controller.renameWorking = true;

		// Open Window
		final String extension = "." + IOInfo.getFileExtension(getFilePath());
		Main.renameWindow.show(getTitle(), node, "Media Renaming", FileCategory.FILE);
		final String oldFilePath = getFilePath();

		// Bind
		title.bind(Main.renameWindow.getInputField().textProperty());
		fileName.bind(Main.renameWindow.getInputField().textProperty().concat(extension));

		// When the Rename Window is closed do the rename
		Main.renameWindow.showingProperty().addListener(new InvalidationListener() {
			/**
			 * [[SuppressWarningsSpartan]]
			 */
			@Override
			public void invalidated(final Observable observable) {

				// Remove the Listener
				Main.renameWindow.showingProperty().removeListener(this);

				// !Showing
				if (!Main.renameWindow.isShowing()) {

					// Remove Binding
					title.unbind();
					fileName.unbind();

					final String newFilePath = new File(oldFilePath).getParent() + File.separator + fileName.get();

					// !XPressed && // Old name != New name
					if (Main.renameWindow.wasAccepted() && !getFilePath().equals(newFilePath)) {

						try {

							// Check if that file already exists
							if (new File(newFilePath).exists()) {
								setFilePath(oldFilePath);
								AlertTool.showNotification("Rename Failed",
										"The action can not been completed:\nA file with that name already exists.",
										Duration.millis(1500), NotificationType.WARNING);
								// controller.renameWorking = false
								return;
							}

							// Check if it can be renamed
							if (!new File(getFilePath()).renameTo(new File(newFilePath))) {
								setFilePath(oldFilePath);
								AlertTool.showNotification("Rename Failed",
										"The action can not been completed(Possible Reasons):\n1) The file is opened by a program,close it and try again.\n2)It doesn't exist anymore..",
										Duration.millis(1500), NotificationType.WARNING);
								// controller.renameWorking = false
								return;
							}

							// Inform all Libraries SmartControllers
							Main.libraryMode.viewer.getItemsObservableList().stream()
									.map(library -> ((Library) library).getSmartController())
									.forEach(smartController -> {

										internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Inform all XPlayers SmartControllers
							Main.xPlayersList.getList().stream().map(
									xPlayerController -> xPlayerController.getxPlayerPlayList().getSmartController())
									.forEach(smartController -> {

										internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Update Emotion Lists SmartControllers
							Main.emotionsTabPane.getTabPane().getTabs().stream()
									.map(tab -> (SmartController) tab.getContent()).forEach(smartController -> {

										internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Inform all XPlayers Models
							Main.xPlayersList.getList().stream().forEach(xPlayerController -> {
								if (oldFilePath.equals(xPlayerController.xPlayerModel.songPathProperty().get())) {

									// filePath
									xPlayerController.xPlayerModel.songPathProperty().set(newFilePath);

									// object
									xPlayerController.playService.checkAudioTypeAndUpdateXPlayerModel(newFilePath);

									// change the text of Marquee
									xPlayerController.mediaFileMarquee.setText(IOInfo.getFileName(newFilePath));

								}
							});

							// Inform Played Media List
							Main.playedSongs.renameMedia(oldFilePath, newFilePath, false);

							// Inform Hated Media List
							Main.emotionListsController.hatedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Disliked Media List
							Main.emotionListsController.dislikedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Liked Media List
							Main.emotionListsController.likedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Loved Media List
							Main.emotionListsController.lovedMediaList.renameMedia(oldFilePath, newFilePath, false);

							// Update the SearchWindow
							Main.searchWindowSmartController.getItemsObservableList().forEach(media -> {
								if (media.getFilePath().equals(oldFilePath))
									media.setFilePath(newFilePath);
							});

							// Let's also fix the TreeView
							Main.treeManager.getService().rename(oldFilePath, newFilePath);

							// Commit to the Database
							Main.dbManager.commit();

							// Show message to user
							AlertTool.showNotification("Success Message",
									"Successfully rename from :\n" + IOInfo.getFileName(oldFilePath) + " \nto\n"
											+ IOInfo.getFileName(newFilePath),
									Duration.millis(2000), NotificationType.SUCCESS);

							// Exception occurred
						} catch (final Exception ex) {
							Main.logger.log(Level.WARNING, "", ex);
							setFilePath(oldFilePath);
							AlertTool.showNotification("Error Message",
									"Failed to rename the File:/n" + ex.getMessage(), Duration.millis(1500),
									NotificationType.ERROR);
						}
					} else // X is pressed by user || // Old name == New name
						setFilePath(oldFilePath);

				} // RenameWindow is still showing
			}// invalidated
		});
		// }
	}

Replace Anonymous With Lambda com.goxr3plus.xr3player.models.smartcontroller.Media.rename.addListener.new InvalidationListener with xPlayerController -> {if(oldFilePath.equals(xPlayerController.xPlayerModel.songPathProperty().get())){xPlayerController.xPlayerModel.songPathProperty().set(newFilePath); in method public mediaRename(oldFilePath String, newFilePath String) : void from class com.goxr3plus.xr3player.models.smartcontroller.Media


	/**
	 * Rename the Media File.
	 *
	 * @param node       The node based on which the Rename Window will be position
	 *                   [[SuppressWarningsSpartan]]
	 */
	public void rename(Node node) {

		// Open Window
		String extension = "." + IOInfo.getFileExtension(getAbsoluteFilePath());
		Main.renameWindow.show(IOInfo.getFileTitle(getAbsoluteFilePath()), node, "Media Renaming", FileCategory.FILE);
		String oldFilePath = getAbsoluteFilePath();

		// Bind
		valueProperty().bind(Main.renameWindow.getInputField().textProperty().concat(!isDirectory() ? extension : ""));

		// When the Rename Window is closed do the rename
		Main.renameWindow.showingProperty().addListener(new InvalidationListener() {
			/**
			 * [[SuppressWarningsSpartan]]
			 */
			@Override
			public void invalidated(Observable observable) {

				// Remove the Listener
				Main.renameWindow.showingProperty().removeListener(this);

				// !Showing
				if (!Main.renameWindow.isShowing()) {

					// Remove Binding
					valueProperty().unbind();

					String newFilePath = new File(oldFilePath).getParent() + File.separator
							+ Main.renameWindow.getInputField().getText() + (!isDirectory() ? extension : "");

					// !XPressed && // Old name != New name
					if (Main.renameWindow.wasAccepted() && !getAbsoluteFilePath().equals(newFilePath)) {

						try {

							// Check if that file already exists
							if (new File(newFilePath).exists()) {
								setAbsoluteFilePath(oldFilePath);
								AlertTool.showNotification("Rename Failed",
										"The action can not been completed:\nA file with that name already exists.",
										Duration.millis(1500), NotificationType.WARNING);
								// controller.renameWorking = false
								return;
							}

							// Check if it can be renamed
							if (!new File(getAbsoluteFilePath()).renameTo(new File(newFilePath))) {
								setAbsoluteFilePath(oldFilePath);
								AlertTool.showNotification("Rename Failed",
										"The action can not been completed(Possible Reasons):\n1) The file is opened by a program,close it and try again.\n2)It doesn't exist anymore..",
										Duration.millis(1500), NotificationType.WARNING);
								// controller.renameWorking = false
								return;
							}

							// Inform all Libraries SmartControllers
							Main.libraryMode.viewer.getItemsObservableList().stream()
									.map(library -> ((Library) library).getSmartController())
									.forEach(smartController -> {

										Media.internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Inform all XPlayers SmartControllers
							Main.xPlayersList.getList().stream().map(
									xPlayerController -> xPlayerController.getxPlayerPlayList().getSmartController())
									.forEach(smartController -> {

										Media.internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Update Emotion Lists SmartControllers
							Main.emotionsTabPane.getTabPane().getTabs().stream()
									.map(tab -> (SmartController) tab.getContent()).forEach(smartController -> {

										Media.internalDataBaseRename(smartController, newFilePath, oldFilePath);

									});

							// Inform all XPlayers Models
							Main.xPlayersList.getList().stream().forEach(xPlayerController -> {
								if (oldFilePath.equals(xPlayerController.xPlayerModel.songPathProperty().get())) {

									// filePath
									xPlayerController.xPlayerModel.songPathProperty().set(newFilePath);

									// object
									xPlayerController.playService.checkAudioTypeAndUpdateXPlayerModel(newFilePath);

									// change the text of Marquee
									xPlayerController.mediaFileMarquee.setText(IOInfo.getFileName(newFilePath));

								}
							});

							// Inform Played Media List
							Main.playedSongs.renameMedia(oldFilePath, newFilePath, false);

							// Inform Hated Media List
							Main.emotionListsController.hatedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Disliked Media List
							Main.emotionListsController.dislikedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Liked Media List
							Main.emotionListsController.likedMediaList.renameMedia(oldFilePath, newFilePath, false);
							// Inform Loved Media List
							Main.emotionListsController.lovedMediaList.renameMedia(oldFilePath, newFilePath, false);

							// Update the SearchWindow
							Main.searchWindowSmartController.getItemsObservableList().forEach(media -> {
								if (media.getFilePath().equals(oldFilePath))
									media.setFilePath(newFilePath);
							});

							// Set new file path
							setAbsoluteFilePath(newFilePath);

							// Commit to the Database
							Main.dbManager.commit();

							// Show message to user
							AlertTool.showNotification("Success Message",
									"Successfully rename from :\n" + IOInfo.getFileName(oldFilePath) + " \nto\n"
											+ IOInfo.getFileName(newFilePath),
									Duration.millis(2000), NotificationType.SUCCESS);

							// Exception occurred
						} catch (Exception ex) {
							Main.logger.log(Level.WARNING, "", ex);
							setAbsoluteFilePath(oldFilePath);
							AlertTool.showNotification("Error Message",
									"Failed to rename the File:/n" + ex.getMessage(), Duration.millis(1500),
									NotificationType.ERROR);
						}
					} else // X is pressed by user || // Old name == New name
						setAbsoluteFilePath(oldFilePath);

				} // RenameWindow is still showing
			}// invalidated
		});
		// }
	}

Replace Anonymous With Lambda com.goxr3plus.xr3player.controllers.systemtree.FileTreeItem.rename.addListener.new InvalidationListener with xPlayerController -> {if(oldFilePath.equals(xPlayerController.xPlayerModel.songPathProperty().get())){xPlayerController.xPlayerModel.songPathProperty().set(newFilePath); in method public mediaRename(oldFilePath String, newFilePath String) : void from class com.goxr3plus.xr3player.models.smartcontroller.Media


	/**
	 * This part is actually loading the application users
	 */
	private void loadTheUsers() {

		//Set Update Screen Visible
		updateScreen.setVisible(true);

		//Create Chromium Folder
		if (!ActionTool.createFileOrFolder(InfoTool.getAbsoluteDatabaseParentFolderPathWithSeparator() + "Chromium", FileType.DIRECTORY)) {
			System.out.println("Failed to create chromium folder");
			Util.terminateXR3Player(-1);
		}

		//Create Database folder if not exists
		if (!ActionTool.createFileOrFolder(InfoTool.getAbsoluteDatabasePathPlain(), FileType.DIRECTORY)) {
			System.out.println("Failed to create database folder[lack of permissions],please change installation directory");
			Util.terminateXR3Player(-1);
		} else {

			//Create the List with the Available Users
			AtomicInteger counter = new AtomicInteger();
			try (Stream<Path> stream = Files.walk(Paths.get(InfoTool.getAbsoluteDatabasePathPlain()), 1)) {

				//Append all available users
				loginMode.teamViewer.addMultipleUsers(stream.filter(path -> path.toFile().isDirectory() && ! ( path + "" ).equals(InfoTool.getAbsoluteDatabasePathPlain()))
						.map(path -> new User(path.getFileName() + "", counter.getAndAdd(1), loginMode)).collect(Collectors.toList()));

			} catch (IOException e) {
				e.printStackTrace();
			}

			//avoid error
			if (!loginMode.teamViewer.getItemsObservableList().isEmpty())
				loginMode.teamViewer.setCenterIndex(loginMode.teamViewer.getItemsObservableList().size() / 2);

		}

		//Create Original xr3database signature file
		ActionTool.createFileOrFolder(InfoTool.getDatabaseSignatureFile().getAbsolutePath(), FileType.FILE);

	}

	/**
	 * This part is actually loading the application users
	 */
	private void loadTheUsers() {

		//Set Update Screen Visible
		updateScreen.setVisible(true);

		//Create Chromium Folder
		if (!ActionTool.createFileOrFolder(InfoTool.getAbsoluteDatabaseParentFolderPathWithSeparator() + "Chromium", FileType.DIRECTORY)) {
			System.out.println("Failed to create chromium folder");
			Util.terminateXR3Player(-1);
		}

		//Create Database folder if not exists
		if (!ActionTool.createFileOrFolder(InfoTool.getAbsoluteDatabasePathPlain(), FileType.DIRECTORY)) {
			System.out.println("Failed to create database folder[lack of permissions],please change installation directory");
			Util.terminateXR3Player(-1);
		} else {

			//Create the List with the Available Users
			AtomicInteger counter = new AtomicInteger();
			try {
				loginMode.teamViewer.addMultipleUsers(Files.walk(Paths.get(InfoTool.getAbsoluteDatabasePathPlain()), 1)
						.filter(path -> path.toFile().isDirectory() && ! ( path + "" ).equals(InfoTool.getAbsoluteDatabasePathPlain()))
						.map(path -> new User(path.getFileName() + "", counter.getAndAdd(1), loginMode)).collect(Collectors.toList()));
			} catch (IOException e) {
				e.printStackTrace();
			}

			//avoid error
			if (!loginMode.teamViewer.getItemsObservableList().isEmpty())
				loginMode.teamViewer.setCenterIndex(loginMode.teamViewer.getItemsObservableList().size() / 2);

		}

		//Create Original xr3database signature file
		ActionTool.createFileOrFolder(InfoTool.getDatabaseSignatureFile().getAbsolutePath(), FileType.FILE);

	}

Try With Resources try(Stream<Path> stream=Files.walk(Paths.get(InfoTool.getAbsoluteDatabasePathPlain()),1)) in method private loadTheUsers() : void from class main.java.com.goxr3plus.xr3player.application.Main


	/**
	 * Checks if the Specific column exists inside the database
	 *
	 * @param table
	 *            The requested table name
	 * @param column
	 *            The requested column name
	 * @return
	 */
	public boolean doesColumnExists(String table , String column) {
		try (PreparedStatement pStatement = Main.dbManager.getConnection().prepareStatement("SELECT " + column + " FROM '" + table + "'")) {
			pStatement.executeQuery();
			return true;
		} catch (SQLException e) {
			//e.printStackTrace()
			return false;
		}
	}

	/**
	 * Checks if the Specific column exists inside the database
	 *
	 * @param table
	 * @param column
	 * @return
	 */
	public boolean doesColumnExists(String table , String column) {
		try {
			Main.dbManager.getConnection().prepareStatement("SELECT " + column + " FROM '" + table + "'").executeQuery();
			return true;
		} catch (SQLException e) {
			//e.printStackTrace();
			return false;
		}
	}

Try With Resources try(PreparedStatement pStatement=Main.dbManager.getConnection().prepareStatement("SELECT " + column + " FROM '" + table + "'")) in method public doesColumnExists(table String, column String) : boolean from class main.java.com.goxr3plus.xr3player.application.speciallists.DatabaseList


	/**
	 * Clears all the Media from the List and Database
	 *
	 * @return True if succeeded or False if not
	 */
	public boolean clearAll(boolean commit) {

		try (Statement statement = Main.dbManager.getConnection().createStatement()) {

			//Clear the table
			statement.executeUpdate("DELETE FROM '" + databaseTableName + "'");
			if (commit)
				Main.dbManager.commit();

			//Clear from Set
			set.clear();
		} catch (Exception ex) {
			Main.logger.log(Level.WARNING, "", ex);
			return false;
		}

		return true;
	}

	/**
	 * Clears all the Media from the List and Database
	 *
	 * @return True if succeeded or False if not
	 */
	public boolean clearAll(boolean commit) {

		try {
			//Clear the table
			Main.dbManager.getConnection().createStatement().executeUpdate("DELETE FROM '" + databaseTableName + "'");
			if (commit)
				Main.dbManager.commit();

			//Clear from Set
			set.clear();
		} catch (Exception ex) {
			Main.logger.log(Level.WARNING, "", ex);
			return false;
		}

		return true;

	}

Try With Resources try(Statement statement=Main.dbManager.getConnection().createStatement()) in method public clearAll(commit boolean) : boolean from class main.java.com.goxr3plus.xr3player.application.speciallists.DatabaseList


	/**
	 * Upload Local File to Dropbox
	 *
	 * @param client
	 *            Current connected client
	 * @param dropBoxFilePath
	 *            The file path on the Dropbox cloud server -> [/foldername/something.txt]
	 * @param localFileAbsolutePath
	 *            The absolute file path of the File on the Local File System
	 * @throws DbxException
	 * @throws IOException
	 */
	public static void uploadFile(DbxClientV2 client , String dropBoxFilePath , String localFileAbsolutePath) throws DbxException , IOException {
		//Create UploadUploader
		UploadUploader uploader = client.files().upload(dropBoxFilePath);

		long size = 0;
		FileInputStream fileInput;

		fileInput = new FileInputStream(localFileAbsolutePath);
		size = fileInput.getChannel().size();

		System.out.println("Size : " + InfoTool.getFileSizeEdited(size));

		//Try to upload the File
		uploader.uploadAndFinish(new ProgressInputStream(fileInput, size,(long completed , long totalSize) -> {
				System.out.println( ( completed * 100 ) / totalSize + " %");
		}));

	}

	/**
	 * Upload Local File to Dropbox
	 *
	 * @param client
	 *            Current connected client
	 * @param dropBoxFilePath
	 *            The file path on the Dropbox cloud server -> [/foldername/something.txt]
	 * @param localFileAbsolutePath
	 *            The absolute file path of the File on the Local File System
	 * @throws DbxException
	 * @throws IOException
	 */
	public static void uploadFile(DbxClientV2 client , String dropBoxFilePath , String localFileAbsolutePath) throws DbxException , IOException {
		//Create UploadUploader
		UploadUploader uploader = client.files().upload(dropBoxFilePath);

		long size = 0;
		FileInputStream fileInput;

		fileInput = new FileInputStream(localFileAbsolutePath);
		size = fileInput.getChannel().size();

		System.out.println("Size : " + InfoTool.getFileSizeEdited(size));

		//Try to upload the File
		uploader.uploadAndFinish(new ProgressInputStream(fileInput, size, new ProgressInputStream.Listener() {
			@Override
			public void uploadProgress(long completed , long totalSize) {
				System.out.println( ( completed * 100 ) / totalSize + " %");
			}
		}));

	}

Replace Anonymous With Lambda main.java.com.goxr3plus.xr3player.remote.dropbox.Dropbox.uploadFile.uploadAndFinish.new ProgressInputStream.new ProgressInputStream.Listener with (completed, totalSize) -> {System.out.println((completed * 100) / totalSize + " %"); in method public uploadFile(client DbxClientV2, dropBoxFilePath String, localFileAbsolutePath String) : void from class main.java.com.goxr3plus.xr3player.remote.dropbox.Dropbox


	/**
	 * Add a new item.
	 *
	 * @param item
	 *            the item
	 * @return True if succeeded or False if not
	 */
	public boolean add(String item) {

		if (set.add(item))
			//Try to insert into the database
			try (PreparedStatement insert = Main.dbManager.getConnection()
					.prepareStatement("INSERT OR IGNORE INTO '" + dataBaseTableName + "' (PATH,TIMESPLAYED,DATE,HOUR) VALUES (?,?,?,?)");) {
				insert.setString(1, item);
				insert.setInt(2, 0);
				insert.setString(3, InfoTool.getCurrentDate());
				insert.setString(4, InfoTool.getLocalTime());
				insert.executeUpdate();

				//Commit
				Main.dbManager.commit();

				return true;
			} catch (SQLException ex) {
				ex.printStackTrace();
				return false;
			}

		return false;
	}

	/**
	 * Add a new item.
	 *
	 * @param item
	 *        the item
	 * @return True if succeeded or False if not
	 */
	public boolean add(String item) {

		try {
			insert.setString(1, item);
			insert.setInt(2, 0);
			insert.setString(3, InfoTool.getCurrentDate());
			insert.setString(4, InfoTool.getLocalTime());
			insert.executeUpdate();

			//Commit
			Main.dbManager.commit();

			return set.add(item);
		} catch (SQLException ex) {
			ex.printStackTrace();
			return false;
		}
	}

Try With Resources try(PreparedStatement insert=Main.dbManager.getConnection().prepareStatement("INSERT OR IGNORE INTO '" + dataBaseTableName + "' (PATH,TIMESPLAYED,DATE,HOUR) VALUES (?,?,?,?)")) in method public add(item String) : boolean from class xplayer.PlayedMediaList


	/**
	 * Renames the media with this name if exists [ in list ].
	 *
	 * @param oldName
	 *            the old name
	 * @param newName
	 *            the new name
	 * @return true, if successful
	 */
	public boolean renameMedia(String oldName , String newName) {
		if (!set.remove(oldName))
			return true;

		//Update in the database
		try (PreparedStatement rename = Main.dbManager.getConnection().prepareStatement("UPDATE '" + dataBaseTableName + "' SET PATH=? WHERE PATH=?")) {
			rename.setString(1, newName);
			rename.setString(2, oldName);
			rename.executeUpdate();

			//Commit
			Main.dbManager.commit();
		} catch (SQLException ex) {
			ex.printStackTrace();
			return false;
		}

		//Add to the Set
		return set.add(newName);

	}

	/**
	 * Renames the media with this name if exists [ in list ].
	 *
	 * @param oldName
	 *        the old name
	 * @param newName
	 *        the new name
	 * @return true, if successful
	 */
	public boolean renameMedia(String oldName , String newName) {
		if (!set.remove(oldName))
			return true;

		//Update in the database
		try {
			rename.setString(1, newName);
			rename.setString(2, oldName);
			rename.executeUpdate();

			//Commit
			Main.dbManager.commit();
		} catch (SQLException ex) {
			ex.printStackTrace();
			return false;
		}

		//Add to the Set
		return set.add(newName);

	}

Try With Resources try(PreparedStatement rename=Main.dbManager.getConnection().prepareStatement("UPDATE '" + dataBaseTableName + "' SET PATH=? WHERE PATH=?")) in method public renameMedia(oldName String, newName String) : boolean from class xplayer.PlayedMediaList


/**
     * Removes the selected songs.
     *
     * @param permanent
     *

     *            true->storage medium + (play list)/library false->only from (play list)/library

     */
    public void removeSelected(boolean permanent) {
	// Free? && How many items are selected?+Question
	if (isFree(true) && tableViewer.getSelectedCount() == 1
		? ActionTool.doDeleteQuestion(permanent, tableViewer.getSelectionModel().getSelectedItem().getFileName(),
			tableViewer.getSelectedCount())
		: ActionTool.doDeleteQuestion(permanent, Integer.toString(tableViewer.getSelectedCount()), tableViewer.getSelectedCount())) {

	    // Remove selected items
	    try (PreparedStatement preparedDelete = Main.dbManager.connection1
		    .prepareStatement("DELETE FROM '" + dataBaseTableName + "' WHERE PATH=?")) {

		//Call the delete for each selected item
		tableViewer.getSelectionModel().getSelectedItems().iterator()
			.forEachRemaining(r -> r.delete(permanent, false, false, this, preparedDelete));

		// Library?
		//		if (genre == Genre.LIBRARYMEDIA)
		//		    Main.libraryMode.updateLibraryTotalLabel(controllerName);

	    } catch (Exception ex) {
		Main.logger.log(Level.WARNING, "", ex);
	    }

	}
    }

/**
     * Removes the selected songs.
     *
     * @param permanent
     *

     *            true->storage medium + (play list)/library false->only from (play list)/library

     */
    public void removeSelected(boolean permanent) {
	// Free? && How many items are selected?+Question
	if (isFree(true) && tableViewer.getSelectedCount() == 1
		? ActionTool.doDeleteQuestion(permanent, tableViewer.getSelectionModel().getSelectedItem().getFileName(),
			tableViewer.getSelectedCount())
		: ActionTool.doDeleteQuestion(permanent, Integer.toString(tableViewer.getSelectedCount()), tableViewer.getSelectedCount())) {

	    // Remove selected items
	    try {
		tableViewer.getSelectionModel().getSelectedItems().iterator().forEachRemaining(r -> r.delete(permanent, false, false, this));

		// Library?
		if (genre == Genre.LIBRARYSONG)
		    Main.libraryMode.updateLibraryTotalLabel(controllerName);

	    } catch (Exception ex) {
		Main.logger.log(Level.WARNING, "", ex);
	    }

	}
    }

Try With Resources try(PreparedStatement preparedDelete=Main.dbManager.connection1.prepareStatement("DELETE FROM '" + dataBaseTableName + "' WHERE PATH=?")) in method public removeSelected(permanent boolean) : void from class smartcontroller.SmartController


		@Override
		public void invalidated(Observable observable) {

		    // Remove the Listener
		    Main.renameWindow.showingProperty().removeListener(this);

		    // !Showing
		    if (!Main.renameWindow.isShowing()) {

			// Remove Binding
			title.unbind();
			fileName.unbind();

			String newName = new File(getFilePath()).getParent() + File.separator + fileName.get();

			// !XPressed && // Old name != New name
			if (Main.renameWindow.wasAccepted() && !getFilePath().equals(newName)) {

			    try (PreparedStatement preparedRename = Main.dbManager.connection1
				    .prepareStatement("UPDATE '" + controller.getDataBaseTableName() + "' SET PATH=? WHERE PATH=?")) {

				// No duplicates allowed
				boolean canPass = true;
				controller.preparedCountElementsWithString.setString(1, newName);
				ResultSet set = controller.preparedCountElementsWithString.executeQuery();
				int total = set.getInt(1);
				if (total > 0)
				    canPass = false;
				set.close();
				// System.out.println("Total is->:" + total)

				// if can pass
				if (canPass) {

				    // Check if that file already exists
				    if (new File(newName).exists()) {
					setFilePath(filePath.get());
					ActionTool.showNotification("Rename Failed",
						"The action can not been completed(Possible Reason):\nA file with that name already exists.",
						Duration.millis(1500), NotificationType.WARNING);
					controller.renameWorking = false;
					return;
				    }

				    // Check if it can be renamed
				    if (!new File(getFilePath()).renameTo(new File(newName))) {
					setFilePath(filePath.get());
					ActionTool.showNotification("Rename Failed",
						"The action can not been completed(Possible Reasons):\n1) The file is opened by a program,close it and try again.\n2)It doesn't exist anymore..",
						Duration.millis(1500), NotificationType.WARNING);
					controller.renameWorking = false;
					return;
				    }

				    // database update
				    preparedRename.setString(1, newName);
				    preparedRename.setString(2, getFilePath());
				    preparedRename.executeUpdate();
				    Main.dbManager.commit();

				    // Rename it in playedSong if...
				    Main.playedSongs.renameMedia(getFilePath(), newName);

				    // change the file path
				    setFilePath(newName);

				} else { // canPass==false
				    setFilePath(filePath.get());
				    ActionTool.showNotification("Dublicate Name",
					    "The action can not been completed because :\nA file with that name already exists.",
					    Duration.millis(1500), NotificationType.INFORMATION);
				}

				// Exception occurred
			    } catch (SQLException ex) {
				Main.logger.log(Level.WARNING, "", ex);
				setFilePath(filePath.get());
				ActionTool.showNotification("Error Message", "Failed to rename the File:/n" + ex.getMessage(), Duration.millis(1500),
					NotificationType.ERROR);
			    }
			} else // X is pressed by user || // Old name == New
			      // name
			    setFilePath(filePath.get());

			// Security Variable
			controller.renameWorking = false;

		    } // RenameWindow is still showing
		}// invalidated

		@Override
		public void invalidated(Observable observable) {

		    // Remove the Listener
		    Main.renameWindow.showingProperty().removeListener(this);

		    // !Showing
		    if (!Main.renameWindow.isShowing()) {

			// Remove Binding
			title.unbind();
			fileName.unbind();

			String newName = new File(getFilePath()).getParent() + File.separator + fileName.get();

			// !XPressed && // Old name != New name
			if (Main.renameWindow.wasAccepted() && !getFilePath().equals(newName)) {

			    try {

				// No duplicates allowed
				boolean canPass = true;
				controller.preparedCountElementsWithString.setString(1, newName);
				ResultSet set = controller.preparedCountElementsWithString.executeQuery();
				int total = set.getInt(1);
				if (total > 0)
				    canPass = false;
				set.close();
				// System.out.println("Total is->:" + total)

				// if can pass
				if (canPass) {

				    // Check if that file already exists
				    if (new File(newName).exists()) {
					setFilePath(filePath.get());
					ActionTool.showNotification("Rename Failed",
						"The action can not been completed(Possible Reason):\nA file with that name already exists.",
						Duration.millis(1500), NotificationType.WARNING);
					controller.renameWorking = false;
					return;
				    }

				    // Check if it can be renamed
				    if (!new File(getFilePath()).renameTo(new File(newName))) {
					setFilePath(filePath.get());
					ActionTool.showNotification("Rename Failed",
						"The action can not been completed(Possible Reasons):\n1) The file is opened by a program,close it and try again.\n2)It doesn't exist anymore..",
						Duration.millis(1500), NotificationType.WARNING);
					controller.renameWorking = false;
					return;
				    }

				    // database update
				    controller.preparedRename.setString(1, newName);
				    controller.preparedRename.setString(2, getFilePath());
				    controller.preparedRename.executeUpdate();
				    Main.dbManager.commit();

				    // Rename it in playedSong if...
				    Main.playedSongs.renameMedia(getFilePath(), newName);

				    // change the file path
				    setFilePath(newName);

				} else { // canPass==false
				    setFilePath(filePath.get());
				    Notifications.create().title("Dublicate Name").text(
					    "The action can not been completed because :\nA file with that name already exists.")
					    .darkStyle().showWarning();
				}

				// Exception occurred
			    } catch (SQLException ex) {
				Main.logger.log(Level.WARNING, "", ex);
				setFilePath(filePath.get());
				ActionTool.showNotification("Error", "error during renaming the file",
					Duration.millis(1500), NotificationType.ERROR);
			    }
			} else // X is pressed by user || // Old name == New
			      // name
			    setFilePath(filePath.get());

			// Security Variable
			controller.renameWorking = false;

		    } // RenameWindow is still showing
		}// invalidated

Try With Resources try(PreparedStatement preparedRename=Main.dbManager.connection1.prepareStatement("UPDATE '" + controller.getDataBaseTableName() + "' SET PATH=? WHERE PATH=?")) in method public invalidated(observable Observable) : void from class media.Media.rename.addListener.new InvalidationListener


	    @Override
	    public void invalidated(Observable observable) {

		// Remove the listener
		Main.starWindow.getWindow().showingProperty().removeListener(this);

		// !showing?
		if (!Main.starWindow.getWindow().isShowing()) {

		    // unbind stars property
		    stars.unbind();

		    // Accepted?
		    if (Main.starWindow.wasAccepted()) {
			try (PreparedStatement preparedUStars = Main.dbManager.connection1
				.prepareStatement("UPDATE '" + controller.getDataBaseTableName() + "' SET STARS=? WHERE PATH=?")) {

			    preparedUStars.setDouble(1, getStars());
			    preparedUStars.setString(2, getFilePath());
			    preparedUStars.executeUpdate();
			    Main.dbManager.commit();

			} catch (Exception ex) {
			    Main.logger.log(Level.WARNING, "", ex);
			    ActionTool.showNotification("Error Message", "Failed to update the stars:/n" + ex.getMessage(), Duration.millis(1500),
				    NotificationType.ERROR);
			}
		    } else
			stars.set(previousStars);
		}
	    }

	    @Override
	    public void invalidated(Observable observable) {

		// Remove the listener
		Main.starWindow.window.showingProperty().removeListener(this);

		// !showing?
		if (!Main.starWindow.window.isShowing()) {

		    // unbind stars property
		    stars.unbind();

		    // Accepted?
		    if (Main.starWindow.wasAccepted()) {
			try {

			    controller.preparedUStars.setDouble(1, getStars());
			    controller.preparedUStars.setString(2, getFilePath());
			    controller.preparedUStars.executeUpdate();
			    Main.dbManager.commit();

			} catch (Exception ex) {
			    Main.logger.log(Level.WARNING, "", ex);
			}
		    } else
			stars.set(previousStars);
		}
	    }

Try With Resources try(PreparedStatement preparedUStars=Main.dbManager.connection1.prepareStatement("UPDATE '" + controller.getDataBaseTableName() + "' SET STARS=? WHERE PATH=?")) in method public invalidated(observable Observable) : void from class media.Media.updateStars.addListener.new InvalidationListener


    /**
     * Stores the Library description into the database.
     */
    public void updateDescription() {
	try (PreparedStatement libUDescription = Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET DESCRIPTION=?" + " WHERE NAME=?;")) {

	    // SQLITE
	    libUDescription.setString(1, description.get());
	    libUDescription.setString(2, getLibraryName());
	    libUDescription.executeUpdate();
	    Main.dbManager.commit();

	} catch (SQLException ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

    /**
     * Stores the Library description into the database.
     */
    public void updateDescription() {
	try {

	    // SQLITE
	    libUDescription.setString(1, description.get());
	    libUDescription.setString(2, getLibraryName());
	    libUDescription.executeUpdate();
	    Main.dbManager.commit();

	} catch (SQLException ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

Try With Resources try(PreparedStatement libUDescription=Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET DESCRIPTION=?" + " WHERE NAME=?;")) in method public updateDescription() : void from class librarysystema.Library


    /**
     * Updates the position variable of Library in database so the next time viewer position it correct.
     *
     * @param newPosition
     *            The new position of the Library
     */
    public void updatePosition(int newPosition) {
	try (PreparedStatement libUPosition = Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET POSITION=?  WHERE NAME=?;")) {
	    position = newPosition;

	    // SQLITE
	    libUPosition.setInt(1, newPosition);
	    libUPosition.setString(2, getLibraryName());
	    libUPosition.executeUpdate();
	} catch (SQLException ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

    /**
     * Updates the position variable of Library in database so the next time viewer position it correct.
     *
     * @param newPosition
     *            The new position of the Library
     */
    public void updatePosition(int newPosition) {
	try {
	    position = newPosition;

	    // SQLITE
	    libUPosition.setInt(1, newPosition);
	    libUPosition.setString(2, getLibraryName());
	    libUPosition.executeUpdate();
	} catch (SQLException ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

Try With Resources try(PreparedStatement libUPosition=Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET POSITION=?  WHERE NAME=?;")) in method public updatePosition(newPosition int) : void from class librarysystema.Library


    /**
     * Updates the Image File.
     *
     * @param absolutePath
     *            The absolute path of the new image to the file system
     * @param renameUpdate
     *            Is this a rename update ?
     * @param commit
     *            If true commit to database
     */
    private boolean updateImagePathInDB(String absolutePath, boolean renameUpdate, boolean commit) {
	boolean success = true;

	try (PreparedStatement libUImage = Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET LIBRARYIMAGE=?  WHERE NAME=?")) {

	    // rename the old image file
	    if (renameUpdate && imageName != null) {

		// Do the rename procedure
		success = new File(getAbsoluteImagePath()).renameTo(new File(absolutePath));

		// Change the image name
		imageName = InfoTool.getFileName(absolutePath);

	    } else { // Create new Image

		// Delete the [[old]] image if exist
		if (imageName != null && !new File(getAbsoluteImagePath()).delete())
		    logger.log(Level.WARNING, "Failed to delete image for LibraryName=[" + getLibraryName() + "]");

		// Create the new image
		String newImageName = Main.dbManager.imagesFolderAbsolutePath + File.separator + getLibraryName() + "." + InfoTool.getFileExtension(absolutePath);

		// Change the image name
		imageName = InfoTool.getFileName(newImageName);

		// Do the copy procedure
		if (!ActionTool.copy(absolutePath, newImageName))
		    logger.log(Level.WARNING, "Failed to create image for LibraryName=[" + getLibraryName() + "]");
	    }

	    // SQLITE
	    libUImage.setString(1, imageName);
	    libUImage.setString(2, getLibraryName());
	    libUImage.executeUpdate();
	    if (commit)
		Main.dbManager.commit();

	} catch (SQLException ex) {
	    success = false;
	    logger.log(Level.WARNING, "", ex);
	}

	return success;
    }

    /**
     * Updates the Image File.
     *
     * @param absolutePath
     *            The absolute path of the new image to the file system
     * @param renameUpdate
     *            Is this a rename update ?
     * @param commit
     *            If true commit to database
     */
    private boolean updateImagePathInDB(String absolutePath, boolean renameUpdate, boolean commit) {
	boolean success = true;

	try {

	    // rename the old image file
	    if (renameUpdate && imageName != null) {

		// Do the rename procedure
		success = new File(getAbsoluteImagePath()).renameTo(new File(absolutePath));

		// Change the image name
		imageName = InfoTool.getFileName(absolutePath);

	    } else { // Create new Image

		// Delete the [[old]] image if exist
		if (imageName != null && !new File(getAbsoluteImagePath()).delete())
		    logger.log(Level.WARNING, "Failed to delete image for LibraryName=[" + getLibraryName() + "]");

		// Create the new image
		String newImageName = Main.dbManager.imagesFolderAbsolutePath + File.separator + getLibraryName() + "."
			+ InfoTool.getFileExtension(absolutePath);

		// Change the image name
		imageName = InfoTool.getFileName(newImageName);

		// Do the copy procedure
		if (!ActionTool.copy(absolutePath, newImageName))
		    logger.log(Level.WARNING, "Failed to create image for LibraryName=[" + getLibraryName() + "]");
	    }

	    // SQLITE
	    libUImage.setString(1, imageName);
	    libUImage.setString(2, getLibraryName());
	    libUImage.executeUpdate();
	    if (commit)
		Main.dbManager.commit();

	} catch (SQLException ex) {
	    success = false;
	    logger.log(Level.WARNING, "", ex);
	}

	return success;
    }

Try With Resources try(PreparedStatement libUImage=Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET LIBRARYIMAGE=?  WHERE NAME=?")) in method private updateImagePathInDB(absolutePath String, renameUpdate boolean, commit boolean) : boolean from class librarysystema.Library


    /**
     * Gives to Library the default image that i had set on resources.
     */
    public void setDefaultImage() {

	try (PreparedStatement libUImage = Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET LIBRARYIMAGE=?  WHERE NAME=?")) {

	    // Ask if user is sure...
	    if (ActionTool.doQuestion("Reset to default the image of this library?", this)) {

		// Delete the [[old]] image if exist
		if (imageName != null && !new File(getAbsoluteImagePath()).delete())
		    logger.log(Level.WARNING, "Failed to delete image for LibraryName=[" + getLibraryName() + "]");

		// Set to null
		imageName = null;

		// Set the default
		imageView.setImage(getImage());

		// SQLITE
		libUImage.setString(1, imageName);
		libUImage.setString(2, getLibraryName());
		libUImage.executeUpdate();
		Main.dbManager.commit();
	    }

	} catch (Exception ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

    /**
     * Gives to Library the default image that i had set on resources.
     */
    public void setDefaultImage() {

	try {

	    // Ask if user is sure...
	    if (ActionTool.doQuestion("Reset to default the image of this library?", this)) {

		// Delete the [[old]] image if exist
		if (imageName != null && !new File(getAbsoluteImagePath()).delete())
		    logger.log(Level.WARNING, "Failed to delete image for LibraryName=[" + getLibraryName() + "]");

		// Set to null
		imageName = null;

		// Set the default
		imageView.setImage(getImage());

		// SQLITE
		libUImage.setString(1, imageName);
		libUImage.setString(2, getLibraryName());
		libUImage.executeUpdate();
		Main.dbManager.commit();
	    }

	} catch (Exception ex) {
	    logger.log(Level.WARNING, "", ex);
	}
    }

Try With Resources try(PreparedStatement libUImage=Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET LIBRARYIMAGE=?  WHERE NAME=?")) in method public setDefaultImage() : void from class librarysystema.Library


    /**
     * Set or not the libraryOpened.
     *
     * @param way
     *            the way
     * @param commit
     *            the commit
     */
    private void setLibraryOpened(boolean way, boolean commit) {

	try (PreparedStatement libUStatus = Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET OPENED=? WHERE NAME=? ;")) {
	    opened.set(way);

	    //commit?
	    if (commit) {
		libUStatus.setBoolean(1, way);
		libUStatus.setString(2, getLibraryName());
		libUStatus.executeUpdate();

		//Commit
		Main.dbManager.commit();
	    }
	} catch (SQLException sql) {
	    sql.printStackTrace();
	}
    }

    /**
     * Set or not the libraryOpened.
     *
     * @param way
     *            the way
     * @param commit
     *            the commit
     */
    private void setLibraryOpened(boolean way, boolean commit) {

	try {
	    opened.set(way);

	    //commit?
	    if (commit) {
		libUStatus.setBoolean(1, way);
		libUStatus.setString(2, getLibraryName());
		libUStatus.executeUpdate();

		//Commit
		Main.dbManager.commit();
	    }
	} catch (SQLException sql) {
	    sql.printStackTrace();
	}
    }

Try With Resources try(PreparedStatement libUStatus=Main.dbManager.connection1.prepareStatement("UPDATE LIBRARIES SET OPENED=? WHERE NAME=? ;")) in method private setLibraryOpened(way boolean, commit boolean) : void from class librarysystema.Library


	@Override
	public void invalidated(Observable observable) {

	    // Remove the Listener
	    Main.renameWindow.showingProperty().removeListener(this);

	    // !Showing && !XPressed
	    if (!Main.renameWindow.isShowing() && !Main.renameWindow.isXPressed()) {

		Main.window.requestFocus();

		// Check if this name already exists
		String name = Main.renameWindow.getUserInput();

		// if can pass
		if (!libraryViewer.items.stream().anyMatch(lib -> lib.getLibraryName().equals(name))) {
		    String dataBaseTableName;
		    boolean validName;

		    // Until the randomName doesn't already exists
		    do {
			dataBaseTableName = ActionTool.returnRandomTableName();
			validName = !LocalDBManager.tableExists(dataBaseTableName);
		    } while (!validName);

		    try (Statement statement = Main.dbManager.connection1.createStatement()) {

			// Create the dataBase table
			statement.executeUpdate("CREATE TABLE '" + dataBaseTableName + "'"
				+ "(PATH       TEXT    PRIMARY KEY   NOT NULL ," + "STARS       DOUBLE     NOT NULL,"
				+ "TIMESPLAYED  INT     NOT NULL," + "DATE        TEXT   	NOT NULL,"
				+ "HOUR        TEXT    NOT NULL)");

			// Create the Library
			Library currentLib = new Library(name, dataBaseTableName, 0, null, null, null, 1,
				libraryViewer.items.size(), null, false);

			// Add the library
			currentLib.goOnSelectionMode(selectionModeToggle.isSelected());
			libraryViewer.addLibrary(currentLib);
			libraryViewer.update();

			// Add a row on libraries table
			insertNewLibrary.setString(1, name);
			insertNewLibrary.setString(2, dataBaseTableName);
			insertNewLibrary.setDouble(3, currentLib.starsProperty().get());
			insertNewLibrary.setString(4, currentLib.getDateCreated());
			insertNewLibrary.setString(5, currentLib.getTimeCreated());
			insertNewLibrary.setString(6, currentLib.getDescription());
			insertNewLibrary.setInt(7, 1);
			insertNewLibrary.setInt(8, currentLib.getPosition());
			insertNewLibrary.setString(9, null);
			insertNewLibrary.setBoolean(10, false);

			insertNewLibrary.executeUpdate();

			// Commit
			Main.dbManager.commit();
		    } catch (Exception ex) {
			Main.logger.log(Level.WARNING, "", ex);
		    }

		    // update the positions
		    updateLibrariesPosition();
		} else {
		    Notifications.create().title("Dublicate Name")
			    .text("A Library or PlayList with this name already exists!").darkStyle().showConfirm();
		}
	    }
	}

	@Override
	public void invalidated(Observable observable) {

	    // Remove the Listener
	    Main.renameWindow.showingProperty().removeListener(this);

	    // !Showing && !XPressed
	    if (!Main.renameWindow.isShowing() && !Main.renameWindow.isXPressed()) {

		Main.window.requestFocus();

		// Check if this name already exists
		String name = Main.renameWindow.getUserInput();

		// if can pass
		if (!libraryViewer.items.stream().anyMatch(lib -> lib.getLibraryName().equals(name))) {
		    String dataBaseTableName;
		    boolean validName;

		    // Until the randomName doesn't already exists
		    do {
			dataBaseTableName = ActionTool.returnRandomTableName();
			validName = !LocalDBManager.tableExists(dataBaseTableName);
		    } while (!validName);

		    try {

			// Create the dataBase table
			Main.dbManager.connection1.createStatement()
				.executeUpdate("CREATE TABLE '" + dataBaseTableName + "'"
					+ "(PATH       TEXT    PRIMARY KEY   NOT NULL ,"
					+ "STARS       DOUBLE     NOT NULL," + "TIMESPLAYED  INT     NOT NULL,"
					+ "DATE        TEXT   	NOT NULL," + "HOUR        TEXT    NOT NULL)");

			// Create the Library
			Library currentLib = new Library(name, dataBaseTableName, 0, null, null, null, 1,
				libraryViewer.items.size(), null, false);

			// Add the library
			currentLib.goOnSelectionMode(selectionModeToggle.isSelected());
			libraryViewer.addLibrary(currentLib);
			libraryViewer.update();

			// Add a row on libraries table
			insertNewLibrary.setString(1, name);
			insertNewLibrary.setString(2, dataBaseTableName);
			insertNewLibrary.setDouble(3, currentLib.starsProperty().get());
			insertNewLibrary.setString(4, currentLib.getDateCreated());
			insertNewLibrary.setString(5, currentLib.getTimeCreated());
			insertNewLibrary.setString(6, currentLib.getDescription());
			insertNewLibrary.setInt(7, 1);
			insertNewLibrary.setInt(8, currentLib.getPosition());
			insertNewLibrary.setString(9, null);
			insertNewLibrary.setBoolean(10, false);

			insertNewLibrary.executeUpdate();

			// Commit
			Main.dbManager.commit();
		    } catch (Exception ex) {
			Main.logger.log(Level.WARNING, "", ex);
		    }

		    // update the positions
		    updateLibrariesPosition();
		} else {
		    Notifications.create().title("Dublicate Name")
			    .text("A Library or PlayList with this name already exists!").darkStyle().showConfirm();
		}
	    }
	}

Try With Resources try(Statement statement=Main.dbManager.connection1.createStatement()) in method public invalidated(observable Observable) : void from class librarymode.LibraryMode.creationInvalidator.new InvalidationListener


	@Override
	public void assignTable(String tableName, Map<String, SqlPrototype> columns) throws ConnectorException {
		try {
			Map<String, SqlPrototypeImpl> columnsImpl = new HashMap<>();
			columns.forEach((name, prototype) -> columnsImpl.put(name, (SqlPrototypeImpl) prototype));
			String statStr = SqlCmd.assignTable(tableName);
			try (PreparedStatement prepStmt = this.connection.prepareStatement(statStr)) {
				prepStmt.execute();
				ResultSet resultSet = prepStmt.getResultSet();
				this.checkPrototypes(resultSet, columnsImpl, tableName);
			}
			this.connection.commit();
		} catch (SQLException exc) {
			ConnectorException.build(exc);
		}
	}

	@Override
	public void assignTable(String tableName, Map<String, SqlPrototype> columns) throws ConnectorException {
		try {
			Map<String, SqlPrototypeImpl> columnsImpl = new HashMap<>();
			columns.forEach((name, prototype) -> columnsImpl.put(name, (SqlPrototypeImpl) prototype));
			Statement stmt = this.connection.createStatement();
			String statStr = SqlCmd.assignTable(tableName);
			stmt.execute(statStr);
			ResultSet resultSet = stmt.getResultSet();
			this.checkPrototypes(resultSet, columnsImpl, tableName);
			stmt.close();
			this.connection.commit();
		} catch (SQLException exc) {
			ConnectorException.build(exc);
		}
	}

Try With Resources try(PreparedStatement prepStmt=this.connection.prepareStatement(statStr)) in method public assignTable(tableName String, columns Map<String,SqlPrototype>) : void from class org.fuchss.sqlconnector.impl.SqlDatabaseImpl


    public static Triplet<Integer, Integer, Integer> fitWallWithShelvesForMinimumRemainingWidth(int wallWidth, int longerShelfWidth, int shorterShelfWidth) {
    	// Result is of the format (# longer shelves, # shorter shelves, remaining width in wall)
    	// Objective is minimum remaining width. However, longer shelves are preferred over shorter ones

    	int numLongerShelves = 0;
    	int numShorterShelves = 0;
    	int minRemainingWidth = wallWidth;

    	int longShelfCounter = 0;
    	int shortShelfCounter = 0;
    	int remainingWidth = 0;

    	while(wallWidth >= longerShelfWidth) {
    		longShelfCounter++;
    		wallWidth -= longerShelfWidth;

    		shortShelfCounter = wallWidth / shorterShelfWidth;
    		remainingWidth = wallWidth % shorterShelfWidth;

    		if(remainingWidth <= minRemainingWidth) {
    			numLongerShelves = longShelfCounter;
    			numShorterShelves = shortShelfCounter;
    			minRemainingWidth = remainingWidth;
    		}

    	}

		return new Triplet<>(numLongerShelves, numShorterShelves, minRemainingWidth);
	}

    public static Triplet<Integer, Integer, Integer> fitWallWithShelvesForMinimumRemainingWidth(int wallWidth, int longerShelfWidth, int shorterShelfWidth) {
    	// Result is of the format (# longer shelves, # shorter shelves, remaining width in wall)
    	// Objective is minimum remaining width. However, longer shelves are preferred over shorter ones

    	int numLongerShelves = 0;
    	int numShorterShelves = 0;
    	int minRemainingWidth = wallWidth;

    	int longShelfCounter = 0;
    	int shortShelfCounter = 0;
    	int remainingWidth = 0;

    	while(wallWidth >= longerShelfWidth) {
    		longShelfCounter++;
    		wallWidth -= longerShelfWidth;

    		shortShelfCounter = wallWidth / shorterShelfWidth;
    		remainingWidth = wallWidth % shorterShelfWidth;

    		if(remainingWidth <= minRemainingWidth) {
    			numLongerShelves = longShelfCounter;
    			numShorterShelves = shortShelfCounter;
    			minRemainingWidth = remainingWidth;
    		}

    	}

		return new Triplet<Integer, Integer, Integer>(numLongerShelves, numShorterShelves, minRemainingWidth);
	}

Replace Generic With Diamond Triplet<Integer,Integer,Integer> with Triplet<> in method public fitWallWithShelvesForMinimumRemainingWidth(wallWidth int, longerShelfWidth int, shorterShelfWidth int) : Triplet<Integer,Integer,Integer> from class org.jwolfe.quetzal.algorithms.GreedyAlgorithms


    public static void visitPreOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = n -> System.out.print(n.getData() + " ");

        visitPreOrder(node, visit);
    }

    public static void visitPreOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                System.out.print(node.getData() + " ");
            }
        };

        visitPreOrder(node, visit);
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.visitPreOrder.visit.new Consumer<BinaryTreeNode> with n -> System.out.print(n.getData() + " ") in method public visitPreOrder(node BinaryTreeNode) : void from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static void visitInOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = n -> System.out.print(n.getData() + " ");

        visitInOrder(node, visit);
    }

    public static void visitInOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                System.out.print(node.getData() + " ");
            }
        };

        visitInOrder(node, visit);
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.visitInOrder.visit.new Consumer<BinaryTreeNode> with n -> System.out.print(n.getData() + " ") in method public visitInOrder(node BinaryTreeNode) : void from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static void visitInOrder(BTNode<Character> node) {
        Consumer<BTNode<Character>> visit = n -> System.out.print(n.getData() + " ");

        visitInOrder(node, visit);
    }

    public static void visitInOrder(BTNode<Character> node) {
        Consumer<BTNode<Character>> visit = new Consumer<BTNode<Character>>() {
            @Override
            public void accept(BTNode<Character> node) {
                System.out.print(node.getData() + " ");
            }
        };

        visitInOrder(node, visit);
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.visitInOrder.visit.new Consumer<BTNode<Character>> with n -> System.out.print(n.getData() + " ") in method public visitInOrder(node BTNode<Character>) : void from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static void visitPostOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = n -> System.out.print(n.getData() + " ");

        visitPostOrder(node, visit);
    }

    public static void visitPostOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                System.out.print(node.getData() + " ");
            }
        };

        visitPostOrder(node, visit);
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.visitPostOrder.visit.new Consumer<BinaryTreeNode> with n -> System.out.print(n.getData() + " ") in method public visitPostOrder(node BinaryTreeNode) : void from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static void visitLevelOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = n -> System.out.print(n.getData() + " ");

        visitLevelOrder(node, visit);
    }

    public static void visitLevelOrder(BinaryTreeNode node) {
        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                System.out.print(node.getData() + " ");
            }
        };

        visitLevelOrder(node, visit);
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.visitLevelOrder.visit.new Consumer<BinaryTreeNode> with n -> System.out.print(n.getData() + " ") in method public visitLevelOrder(node BinaryTreeNode) : void from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    private static List<Integer> getInorderList(BinaryTreeNode node) {
        ArrayList<Integer> inOrderList = new ArrayList<>();
        Consumer<BinaryTreeNode> inOrderVisitor = n -> inOrderList.add(n.getData());

        visitInOrder(node, inOrderVisitor);
        return inOrderList;
    }

    private static List<Integer> getInorderList(BinaryTreeNode node) {
        ArrayList<Integer> inOrderList = new ArrayList<>();
        Consumer<BinaryTreeNode> inOrderVisitor = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                inOrderList.add(node.getData());
            }
        };

        visitInOrder(node, inOrderVisitor);
        return inOrderList;
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getInorderList.inOrderVisitor.new Consumer<BinaryTreeNode> with n -> inOrderList.add(n.getData()) in method private getInorderList(node BinaryTreeNode) : List<Integer> from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    private static List<Integer> getPreOrderList(BinaryTreeNode node) {
        ArrayList<Integer> preOrderList = new ArrayList<>();
        Consumer<BinaryTreeNode> preOrderVisitor = n -> preOrderList.add(n.getData());

        visitPreOrder(node, preOrderVisitor);
        return preOrderList;
    }

    private static List<Integer> getPreOrderList(BinaryTreeNode node) {
        ArrayList<Integer> preOrderList = new ArrayList<>();
        Consumer<BinaryTreeNode> preOrderVisitor = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                preOrderList.add(node.getData());
            }
        };

        visitPreOrder(node, preOrderVisitor);
        return preOrderList;
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getPreOrderList.preOrderVisitor.new Consumer<BinaryTreeNode> with n -> preOrderList.add(n.getData()) in method private getPreOrderList(node BinaryTreeNode) : List<Integer> from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static int[] getLevelOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = n -> collector.add(n.getData());

        visitLevelOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

    public static int[] getLevelOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                collector.add(node.getData());
            }
        };

        visitLevelOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getLevelOrder.visit.new Consumer<BinaryTreeNode> with n -> collector.add(n.getData()) in method public getLevelOrder(root BinaryTreeNode) : int[] from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static int[] getPreOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = n -> collector.add(n.getData());

        visitPreOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

    public static int[] getPreOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                collector.add(node.getData());
            }
        };

        visitPreOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getPreOrder.visit.new Consumer<BinaryTreeNode> with n -> collector.add(n.getData()) in method public getPreOrder(root BinaryTreeNode) : int[] from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static int[] getInOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = n -> collector.add(n.getData());

        visitInOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

    public static int[] getInOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                collector.add(node.getData());
            }
        };

        visitInOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getInOrder.visit.new Consumer<BinaryTreeNode> with n -> collector.add(n.getData()) in method public getInOrder(root BinaryTreeNode) : int[] from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


    public static int[] getPostOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = n -> collector.add(n.getData());

        visitPostOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

    public static int[] getPostOrder(BinaryTreeNode root) {
        ArrayList<Integer> collector = new ArrayList<>();

        Consumer<BinaryTreeNode> visit = new Consumer<BinaryTreeNode>() {
            @Override
            public void accept(BinaryTreeNode node) {
                collector.add(node.getData());
            }
        };

        visitPostOrder(root, visit);

        return collector.stream().mapToInt(i -> i).toArray();
    }

Replace Anonymous With Lambda org.jwolfe.quetzal.algorithms.TreeAlgorithms.getPostOrder.visit.new Consumer<BinaryTreeNode> with n -> collector.add(n.getData()) in method public getPostOrder(root BinaryTreeNode) : int[] from class org.jwolfe.quetzal.algorithms.TreeAlgorithms


	public Value eval(EvalContext ctx, Value[] args, Type resultType) {
		if (args[0].isUndefined()) return UndefinedValue.instance;

		SequenceValue col = (SequenceValue)args[0];
		ArrayList<Value> elements = new ArrayList<>(col.collection());
		Collections.reverse(elements);

		return new SequenceValue(col.elemType(), elements);
	}

	public Value eval(EvalContext ctx, Value[] args, Type resultType) {
		if (args[0].isUndefined()) return UndefinedValue.instance;

		SequenceValue col = (SequenceValue)args[0];
		ArrayList<Value> elements = new ArrayList<Value>(col.collection());
		Collections.reverse(elements);

		return new SequenceValue(col.elemType(), elements);
	}

Replace Generic With Diamond ArrayList<Value> with ArrayList<> in method public eval(ctx EvalContext, args Value[], resultType Type) : Value from class org.tzi.use.uml.ocl.expr.operations.Op_sequence_reverse


	public Value eval(EvalContext ctx, Value[] args, Type resultType) {
		if (args[0].isUndefined()) return UndefinedValue.instance;

		SequenceValue col = (SequenceValue)args[0];
		ArrayList<Value> elements = new ArrayList<>(col.collection());
		Collections.shuffle(elements);

		return new SequenceValue(col.elemType(), elements);
	}

	public Value eval(EvalContext ctx, Value[] args, Type resultType) {
		if (args[0].isUndefined()) return UndefinedValue.instance;

		SequenceValue col = (SequenceValue)args[0];
		ArrayList<Value> elements = new ArrayList<Value>(col.collection());
		Collections.shuffle(elements);

		return new SequenceValue(col.elemType(), elements);
	}

Replace Generic With Diamond ArrayList<Value> with ArrayList<> in method public eval(ctx EvalContext, args Value[], resultType Type) : Value from class org.tzi.use.uml.ocl.expr.operations.Op_sequence_shuffle


	private String getFirstWordOfFile(String filename) {
		try {
			String result = "";
			// Handle possible UTF BOM
			Reader r = getReaderFromFilename(filename);

			try (BufferedReader bf = new BufferedReader(r)){
				boolean isComment = false;
				boolean noCase = false;
				boolean cont = false;

				for (String line = bf.readLine(); line != null; line = bf
						.readLine()) {
					line = line.trim();
					while (!noCase) {
						noCase = true;
						if (line.startsWith("--")) {
							noCase = true;
							cont = true;
							continue;
						}
						if (line.startsWith("@")) {
							noCase = true;
							cont = true;
							continue;
						}
						if (line.startsWith("/*")) {
							noCase = false;
							isComment = true;
							line = line.substring(line.indexOf("/*") + 2).trim();
						}
						if (isComment == true) {
							noCase = false;
							int index = line.indexOf("*/");
							if (index != -1) {
								line = line.substring(index + 2).trim();
								isComment = false;
							}
							if (index == -1) {
								noCase = true;
								cont = true;
								continue;
							}
						}
					}
					if (cont || line.trim().equals("")) {
						cont = false;
						noCase = false;
						continue;
					}
					StringTokenizer st = new StringTokenizer(line);
					result = st.nextToken();
					return result;
				}
			}
		} catch (FileNotFoundException e) {
			// ignored
			Log.println("Error: File `" + filename + "' could not be found!");
			return "ERROR: -1";
		} catch (IOException e) {
			// ignored
		}
		return null;
	}

    private String getFirstWordOfFile(String filename) {
    	BufferedReader bf = null;

    	try {
            String result = "";
            // Handle possible UTF BOM
            Reader r = getReaderFromFilename(filename);
            bf = new BufferedReader(r);
            boolean isComment = false;
            boolean noCase = false;
            boolean cont = false;

            for (String line = bf.readLine(); line != null; line = bf
                    .readLine()) {
                line = line.trim();
                while (!noCase) {
                    noCase = true;
                    if (line.startsWith("--")) {
                        noCase = true;
                        cont = true;
                        continue;
                    }
                    if (line.startsWith("@")) {
                        noCase = true;
                        cont = true;
                        continue;
                    }
                    if (line.startsWith("/*")) {
                        noCase = false;
                        isComment = true;
                        line = line.substring(line.indexOf("/*") + 2).trim();
                    }
                    if (isComment == true) {
                        noCase = false;
                        int index = line.indexOf("*/");
                        if (index != -1) {
                            line = line.substring(index + 2).trim();
                            isComment = false;
                        }
                        if (index == -1) {
                            noCase = true;
                            cont = true;
                            continue;
                        }
                    }
                }
                if (cont || line.trim().equals("")) {
                    cont = false;
                    noCase = false;
                    continue;
                }
                StringTokenizer st = new StringTokenizer(line);
                result = st.nextToken();
                return result;
            }
        } catch (FileNotFoundException e) {
            // ignored
            Log.println("Error: File `" + filename + "' could not be found!");
            return "ERROR: -1";
        } catch (IOException e) {
            // ignored
        } finally {
        	if (bf != null)
				try {
					bf.close();
				} catch (IOException e) {}
        }
        return null;
    }

Try With Resources try(BufferedReader bf=new BufferedReader(r)) in method private getFirstWordOfFile(filename String) : String from class org.tzi.use.main.shell.Shell


    protected void internalError(GEvaluationException e, long randomNr) {
        String nl = Options.LINE_SEPARATOR;
        try (PrintWriter pw = new PrintWriter(new FileWriter("generator_error.txt"))){
            pw.println("Program version: " + Options.RELEASE_VERSION);
            pw.println("Stack trace:");
            e.printStackTrace(pw);
            pw.close();
            System.err.println("THE GENERATOR HAS AN INTERNAL ERROR." + nl +
                               "PLEASE SEND THE FILE `generator_error.txt'"+nl+
                               "TO " + Options.SUPPORT_MAIL + ".");
            System.err.println("The random number generator was "
                               + "initialized with " + randomNr + ".");
        } catch (IOException ioException) {
            System.err.println("THE GENERATOR HAS AN INTERNAL ERROR." + nl +
                               "PLEASE SEND THE FOLLOWING INFORMATION "+nl+
                               "TO " + Options.SUPPORT_MAIL + ".");
            System.err.println("Program version: " + Options.RELEASE_VERSION);
            System.err.println("Stack trace: ");
            e.printStackTrace();
        }
    }

    protected void internalError(GEvaluationException e, long randomNr) {
        String nl = Options.LINE_SEPARATOR;
        try {
            PrintWriter pw
                = new PrintWriter(new FileWriter("generator_error.txt"));
            pw.println("Program version: " + Options.RELEASE_VERSION);
            pw.println("Stack trace: ");
            e.printStackTrace(pw);
            pw.close();
            System.err.println("THE GENERATOR HAS AN INTERNAL ERROR." + nl +
                               "PLEASE SEND THE FILE `generator_error.txt'"+nl+
                               "TO " + Options.SUPPORT_MAIL + ".");
            System.err.println("The random number generator was "
                               + "initialized with " + randomNr + ".");
        } catch (IOException ioException) {
            System.err.println("THE GENERATOR HAS AN INTERNAL ERROR." + nl +
                               "PLEASE SEND THE FOLLOWING INFORMATION "+nl+
                               "TO " + Options.SUPPORT_MAIL + ".");
            System.err.println("Program version: " + Options.RELEASE_VERSION);
            System.err.println("Stack trace: ");
            e.printStackTrace();
        }
    }

Try With Resources try(PrintWriter pw=new PrintWriter(new FileWriter("generator_error.txt"))) in method protected internalError(e GEvaluationException, randomNr long) : void from class org.tzi.use.gen.tool.GGenerator


    /**
     * Writes source files for aspect-based monitoring of applications.
     */
    private void cmdGenMonitor() throws NoSystemException {
        MSystem system = system();
        String filename = "USEMonitor.java";
        try (PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(filename)))){
            Log.verbose("writing file `" + filename + "'...");

            new MonitorAspectGenerator(out, system.model()).write();
            Log.verbose("done.");
        } catch (IOException ex) {
            Log.error(ex.getMessage());
        }
    }

    /**
     * Writes source files for aspect-based monitoring of applications.
     */
    private void cmdGenMonitor() throws NoSystemException {
        MSystem system = system();
        String filename = "USEMonitor.java";
        PrintWriter out = null;
        try {
        	out = new PrintWriter(new BufferedWriter(new FileWriter(
                    filename)));
            Log.verbose("writing file `" + filename + "'...");

            new MonitorAspectGenerator(out, system.model()).write();
            Log.verbose("done.");
        } catch (IOException ex) {
            Log.error(ex.getMessage());
        } finally {
            if (out != null) {
                out.flush();
                out.close();
            }
        }
    }

Try With Resources try(PrintWriter out=new PrintWriter(new BufferedWriter(new FileWriter(filename)))) in method private cmdGenMonitor() : void from class org.tzi.use.main.shell.Shell


    /**
     * Reads a specification file.
     */
    private void cmdOpenUseFile(String file) {
        MModel model = null;

        String filename = getFilenameToOpen(file);

        try (BufferedInputStream specStream = new BufferedInputStream(new FileInputStream(filename))){
            Log.println("compiling specification...");
            handleBOM(specStream);
            model = USECompiler.compileSpecification(specStream, filename,
                    new PrintWriter(System.err), new ModelFactory());
	    Log.println("done");
        } catch (FileNotFoundException e) {
            Log.error("File `" + filename + "' not found.");
        } catch (IOException e) {
        	Log.error("IO error while accessing `" + filename + "': " + e.getMessage());
		}

        // compile ok?
        if (model != null) {
            // print some info about model
            Log.println(model.getStats());

            // create system
            fSession.setSystem(new MSystem(model));
        }

        setFileClosed();
    }

    /**
     * Reads a specification file.
     */
    private void cmdOpenUseFile(String file) {
        MModel model = null;
        BufferedInputStream specStream = null;

        String filename = getFilenameToOpen(file);

        try {
            Log.println("compiling specification...");
            specStream = new BufferedInputStream(new FileInputStream(filename));
            handleBOM(specStream);
            model = USECompiler.compileSpecification(specStream, filename,
                    new PrintWriter(System.err), new ModelFactory());
	    Log.println("done");
        } catch (FileNotFoundException e) {
            Log.error("File `" + filename + "' not found.");
        } catch (IOException e) {
        	Log.error("IO error while accessing `" + filename + "': " + e.getMessage());
		} finally {
			if (specStream != null)
				try {
					specStream.close();
				} catch (IOException ex) {}
		}

        // compile ok?
        if (model != null) {
            // print some info about model
            Log.println(model.getStats());

            // create system
            fSession.setSystem(new MSystem(model));
        }

        setFileClosed();
    }

Try With Resources try(BufferedInputStream specStream=new BufferedInputStream(new FileInputStream(filename))) in method private cmdOpenUseFile(file String) : void from class org.tzi.use.main.shell.Shell


    private void cmdRunTestSuite(String file) {
        String filename = getFilenameToOpen(file);
        MTestSuite testSuite = null;
        MModel model = null;

        try {
        	model = system().model();
        } catch (NoSystemException e) {
        	Log.error("Cannot run test suite without a loaded model");
        	return;
        }

        try (BufferedInputStream specStream = new BufferedInputStream(new FileInputStream(filename))){
            Log.verbose("compiling test suite...");
            handleBOM(specStream);
            testSuite = TestSuiteCompiler.compileTestSuite(specStream, filename,
                    new PrintWriter(System.err), model);
        } catch (FileNotFoundException e) {
            Log.error("File `" + filename + "' not found.");
        } catch (IOException e) {
			Log.error("Error accessing file " + StringUtil.inQuotes(filename) + ": " + e.getMessage());
		}

        // compile ok?
        if (testSuite != null) {
            PrintWriter output = new PrintWriter(Log.out());
            Log.println(testSuite.getStats());
            // create system
            testSuite.run(output);
        }

        setFileClosed();
    }

    private void cmdRunTestSuite(String file) {
    	BufferedInputStream specStream = null;
        String filename = getFilenameToOpen(file);
        MTestSuite testSuite = null;
        MModel model = null;

        try {
        	model = system().model();
        } catch (NoSystemException e) {
        	Log.error("Cannot run test suite without a loaded model");
        	return;
        }

        try {
            Log.verbose("compiling test suite...");
            specStream = new BufferedInputStream(new FileInputStream(filename));
            handleBOM(specStream);
            testSuite = TestSuiteCompiler.compileTestSuite(specStream, filename,
                    new PrintWriter(System.err), model);
        } catch (FileNotFoundException e) {
            Log.error("File `" + filename + "' not found.");
        } catch (IOException e) {
			Log.error("Error accessing file " + StringUtil.inQuotes(filename) + ": " + e.getMessage());
		} finally {
            if (specStream != null)
                try {
                	specStream.close();
                } catch (IOException ex) {}
        }

        // compile ok?
        if (testSuite != null) {
            PrintWriter output = new PrintWriter(Log.out());
            Log.println(testSuite.getStats());
            // create system
            testSuite.run(output);
        }

        setFileClosed();
    }

Try With Resources try(BufferedInputStream specStream=new BufferedInputStream(new FileInputStream(filename))) in method private cmdRunTestSuite(file String) : void from class org.tzi.use.main.shell.Shell


	private void cmdGenLoadInvariants(String str, MSystem system, boolean doEcho) {
		String filename = str.trim();
		if (filename.length() == 0)
			Log.error("syntax is `load FILE'");
		else {
			filename = getFilenameToOpen(filename);
			try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(filename))){
				handleBOM(in);

				system.loadInvariants(in, str.trim(), doEcho, new PrintWriter(getOut(), true));

				setFileClosed();
			} catch (FileNotFoundException e) {
				Log.error("File " + StringUtil.inQuotes(filename) + " not found!");
				return;
			} catch (IOException e) {
				Log.error("Error accessing file " + StringUtil.inQuotes(filename) + ": " + e.getMessage());
				return;
			}
		}
	}

	private void cmdGenLoadInvariants(String str, MSystem system, boolean doEcho) {
		String filename = str.trim();
		if (filename.length() == 0)
			Log.error("syntax is `load FILE'");
		else {
			BufferedInputStream in = null;
			try {
				filename = getFilenameToOpen(filename);
				in = new BufferedInputStream(new FileInputStream(filename));
				handleBOM(in);

				system.loadInvariants(in, str.trim(), doEcho, new PrintWriter(getOut(), true));

				setFileClosed();
			} catch (FileNotFoundException e) {
				Log.error("File " + StringUtil.inQuotes(filename) + " not found!");
				return;
			} catch (IOException e) {
				Log.error("Error accessing file " + StringUtil.inQuotes(filename) + ": " + e.getMessage());
				return;
			} finally {
				if (in != null) {
					try {
						in.close();
					} catch (IOException e) {}
				}
			}
		}
	}

Try With Resources try(BufferedInputStream in=new BufferedInputStream(new FileInputStream(filename))) in method private cmdGenLoadInvariants(str String, system MSystem, doEcho boolean) : void from class org.tzi.use.main.shell.Shell