	public void colorize(InputFile i) {
		final File f = i.file();
		LOGGER.info("Color the file: " + f.getPath());
		highlighting.onFile(i);
		try (final BufferedReader br = new BufferedReader(
				new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8))) {

			String line;
			int lineNumber = 1;
			while ((line = br.readLine()) != null) {
				searchAndColor(line, lineNumber);
				lineNumber++;
			}
			br.close();
		} catch (final IOException e) {
			LOGGER.error("IO Exception", e);
		}

		highlighting.save();

	}

	public void colorize(InputFile i) {
		final File f = i.file();
		LOGGER.info("Color the file: " + f.getPath());
		highlighting.onFile(i);
		try {
			final BufferedReader br = new BufferedReader(
					new InputStreamReader(new FileInputStream(f), StandardCharsets.UTF_8));
			String line;
			int lineNumber = 1;
			while ((line = br.readLine()) != null) {
				searchAndColor(line, lineNumber);
				lineNumber++;
			}
			br.close();
		} catch (final IOException e) {
			LOGGER.error("IO Exception", e);
		}

		highlighting.save();

	}

Try With Resources try(final BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream(f),StandardCharsets.UTF_8))) in method public colorize(i InputFile) : void from class fr.univartois.sonargo.highlighter.Colorizer


    public Player(String sessionId, String name, Library library) {
        this.sessionId = sessionId;
        this.name = name;
        this.life = 20;
        this.library = library;
        this.hand = new Hand();
        this.battlefield = new Battlefield();
        this.graveyard = new Graveyard();

        IntStream.rangeClosed(1, 7)
                .forEach(i -> this.hand.addCard(this.library.draw()));
    }

    public Player(String sessionId, String name, Library library) {
        this.sessionId = sessionId;
        this.name = name;
        this.life = 20;
        this.library = library;
        this.hand = new Hand();
        this.battlefield = new Battlefield();
        this.graveyard = new Graveyard();

        for (int i = 0; i < 7; i++) {
            this.hand.addCard(this.library.draw());
        }
    }

Replace Loop With Pipeline for(int i=0; i < 7; i++) with IntStream.rangeClosed(1,7).forEach(i -> this.hand.addCard(this.library.draw())); in method public Player(sessionId String, name String, library Library) from class com.aa.mtg.game.player.Player


    public ArrayList<ItemStack> getBuyableUpgrades() {
        //todo expand with based on events and achievements
        ArrayList<ItemStack> items = new ArrayList<>();
        for (UpgradesBasedOnStats u : UpgradesBasedOnStats.values()) {
            if (u.requirementMetAndNotUnlocked(this)) {
                items.add(u.createItem(this));
            }
        }
        for (UpgradesBasedOnBuildings ub : UpgradesBasedOnBuildings.values()) {
            if (ub.requirementMetAndNotUnlocked(this)) {
                items.add(ub.createItem(this));
            }
        }
        return items;
    }

    public ArrayList<ItemStack> getBuyableUpgrades() {
        //todo expand with based on events and achievements
        ArrayList<ItemStack> items = new ArrayList<ItemStack>();
        for (UpgradesBasedOnStats u : UpgradesBasedOnStats.values()) {
            if (u.requirementMetAndNotUnlocked(this)) {
                items.add(u.createItem(this));
            }
        }
        for (UpgradesBasedOnBuildings ub : UpgradesBasedOnBuildings.values()) {
            if (ub.requirementMetAndNotUnlocked(this)) {
                items.add(ub.createItem(this));
            }
        }
        return items;
    }

Replace Generic With Diamond ArrayList<ItemStack> with ArrayList<> in method public getBuyableUpgrades() : ArrayList<ItemStack> from class io.github.stealingdapenta.foodclicker.clickingplayers.ClickingPlayer


    @Test
    public void testSignalDuringLastDecision() throws InterruptedException {
        worker.addWorkflowImplementationType(TestSignalDuringLastDecisionWorkflowImpl.class);
        StartWorkflowOptions options = newStartWorkflowOptions();
        options.setWorkflowId("testSignalDuringLastDecision-" + UUID.randomUUID().toString());
        TestWorkflowSignaled client = cadenceClient.newWorkflowStub(TestWorkflowSignaled.class, options);
        WorkflowExternalResult<String> result = CadenceClient.asyncStart(client::execute);
        try {
            sendSignal.get(2, TimeUnit.SECONDS);
            client.signal1("Signal Input");
        } catch (TimeoutException | ExecutionException e) {
            throw new RuntimeException(e);
        }
        assertEquals("Signal Input", result.getResult());
    }

    @Test
    public void testSignalDuringLastDecision() throws TimeoutException, InterruptedException {
        worker.addWorkflowImplementationType(TestSignalDuringLastDecisionWorkflowImpl.class);
        StartWorkflowOptions options = newStartWorkflowOptions();
        options.setWorkflowId("testSignalDuringLastDecision-" + UUID.randomUUID().toString());
        TestWorkflowSignaled client = cadenceClient.newWorkflowStub(TestWorkflowSignaled.class, options);
        WorkflowExternalResult<String> result = CadenceClient.asyncStart(client::execute);
        try {
            sendSignal.get(2, TimeUnit.SECONDS);
            client.signal1("Signal Input");
        } catch (TimeoutException e) {
            throw new RuntimeException(e);
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }
        assertEquals("Signal Input", result.getResult());
    }

Merge Catch [catch(TimeoutException e), catch(ExecutionException e)] to catch(TimeoutException|ExecutionException e) in method public testSignalDuringLastDecision() : void from class com.uber.cadence.workflow.WorkflowTest


    public static void initAsyncInvocation() {
        if (asyncResult.get() != null) {
            throw new IllegalStateException("already in async invocation");
        }
        asyncResult.set(new AtomicReference<>());
    }

    public static void initAsyncInvocation() {
        if (asyncResult.get() != null) {
            throw new IllegalStateException("already in async invocation");
        }
        asyncResult.set(new AtomicReference<WorkflowFuture>());
    }

Replace Generic With Diamond AtomicReference<WorkflowFuture> with AtomicReference<> in method public initAsyncInvocation() : void from class com.uber.cadence.internal.dispatcher.ActivityInvocationHandler


    public void reRunScheduleServer() throws Exception {
        for (ScheduleStrategyRunntime run : this.scheduleStrategyManager
            .loadAllScheduleStrategyRunntimeByUUID(this.uuid)) {
            List<IStrategyTask> list = this.managerMap.get(run.getStrategyName());
            if (list == null) {
                list = new ArrayList<>();
                this.managerMap.put(run.getStrategyName(), list);
            }
            while (list.size() > run.getRequestNum() && list.size() > 0) {
                IStrategyTask task = list.remove(list.size() - 1);
                try {
                    task.stop(run.getStrategyName());
                } catch (Throwable e) {
                    logger.error("注销任务错误：strategyName=" + run.getStrategyName(), e);
                }
            }
            // 不足，增加调度器
            ScheduleStrategy strategy = this.scheduleStrategyManager.loadStrategy(run.getStrategyName());
            while (list.size() < run.getRequestNum()) {
                IStrategyTask result = this.createStrategyTask(strategy);
                if (null == result) {
                    logger.error("strategy 对应的配置有问题。strategy name=" + strategy.getStrategyName());
                }
                list.add(result);
            }
        }
    }

    public void reRunScheduleServer() throws Exception {
        for (ScheduleStrategyRunntime run : this.scheduleStrategyManager
            .loadAllScheduleStrategyRunntimeByUUID(this.uuid)) {
            List<IStrategyTask> list = this.managerMap.get(run.getStrategyName());
            if (list == null) {
                list = new ArrayList<IStrategyTask>();
                this.managerMap.put(run.getStrategyName(), list);
            }
            while (list.size() > run.getRequestNum() && list.size() > 0) {
                IStrategyTask task = list.remove(list.size() - 1);
                try {
                    task.stop(run.getStrategyName());
                } catch (Throwable e) {
                    logger.error("注销任务错误：strategyName=" + run.getStrategyName(), e);
                }
            }
            // 不足，增加调度器
            ScheduleStrategy strategy = this.scheduleStrategyManager.loadStrategy(run.getStrategyName());
            while (list.size() < run.getRequestNum()) {
                IStrategyTask result = this.createStrategyTask(strategy);
                if (null == result) {
                    logger.error("strategy 对应的配置有问题。strategy name=" + strategy.getStrategyName());
                }
                list.add(result);
            }
        }
    }

Replace Generic With Diamond ArrayList<IStrategyTask> with ArrayList<> in method public reRunScheduleServer() : void from class com.taobao.pamirs.schedule.strategy.TBScheduleManagerFactory


    public List<ScheduleStrategy> loadAllScheduleStrategy() throws Exception {
        String zkPath = this.PATH_Strategy;
        List<ScheduleStrategy> result = new ArrayList<>();
        List<String> names = this.getZooKeeper().getChildren(zkPath, false);
        Collections.sort(names);
        for (String name : names) {
            result.add(this.loadStrategy(name));
        }
        return result;
    }

    public List<ScheduleStrategy> loadAllScheduleStrategy() throws Exception {
        String zkPath = this.PATH_Strategy;
        List<ScheduleStrategy> result = new ArrayList<ScheduleStrategy>();
        List<String> names = this.getZooKeeper().getChildren(zkPath, false);
        Collections.sort(names);
        for (String name : names) {
            result.add(this.loadStrategy(name));
        }
        return result;
    }

Replace Generic With Diamond ArrayList<ScheduleStrategy> with ArrayList<> in method public loadAllScheduleStrategy() : List<ScheduleStrategy> from class com.taobao.pamirs.schedule.zk.ScheduleStrategyDataManager4ZK


    /**
     * 装载所有的策略运行状态
     */
    public List<ScheduleStrategyRunntime> loadAllScheduleStrategyRunntime() throws Exception {
        List<ScheduleStrategyRunntime> result = new ArrayList<>();
        String zkPath = this.PATH_Strategy;
        for (String taskType : this.getZooKeeper().getChildren(zkPath, false)) {
            for (String uuid : this.getZooKeeper().getChildren(zkPath + "/" + taskType, false)) {
                result.add(loadScheduleStrategyRunntime(taskType, uuid));
            }
        }
        return result;
    }

    /**
     * 装载所有的策略运行状态
     */
    public List<ScheduleStrategyRunntime> loadAllScheduleStrategyRunntime() throws Exception {
        List<ScheduleStrategyRunntime> result = new ArrayList<ScheduleStrategyRunntime>();
        String zkPath = this.PATH_Strategy;
        for (String taskType : this.getZooKeeper().getChildren(zkPath, false)) {
            for (String uuid : this.getZooKeeper().getChildren(zkPath + "/" + taskType, false)) {
                result.add(loadScheduleStrategyRunntime(taskType, uuid));
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<ScheduleStrategyRunntime> with ArrayList<> in method public loadAllScheduleStrategyRunntime() : List<ScheduleStrategyRunntime> from class com.taobao.pamirs.schedule.zk.ScheduleStrategyDataManager4ZK


    public List<ScheduleStrategyRunntime> loadAllScheduleStrategyRunntimeByUUID(String managerFactoryUUID)
        throws Exception {
        List<ScheduleStrategyRunntime> result = new ArrayList<>();
        String zkPath = this.PATH_Strategy;

        List<String> taskTypeList = this.getZooKeeper().getChildren(zkPath, false);
        Collections.sort(taskTypeList);
        for (String taskType : taskTypeList) {
            if (this.getZooKeeper().exists(zkPath + "/" + taskType + "/" + managerFactoryUUID, false) != null) {
                result.add(loadScheduleStrategyRunntime(taskType, managerFactoryUUID));
            }
        }
        return result;
    }

    public List<ScheduleStrategyRunntime> loadAllScheduleStrategyRunntimeByUUID(String managerFactoryUUID)
        throws Exception {
        List<ScheduleStrategyRunntime> result = new ArrayList<ScheduleStrategyRunntime>();
        String zkPath = this.PATH_Strategy;

        List<String> taskTypeList = this.getZooKeeper().getChildren(zkPath, false);
        Collections.sort(taskTypeList);
        for (String taskType : taskTypeList) {
            if (this.getZooKeeper().exists(zkPath + "/" + taskType + "/" + managerFactoryUUID, false) != null) {
                result.add(loadScheduleStrategyRunntime(taskType, managerFactoryUUID));
            }
        }
        return result;
    }

Replace Generic With Diamond ArrayList<ScheduleStrategyRunntime> with ArrayList<> in method public loadAllScheduleStrategyRunntimeByUUID(managerFactoryUUID String) : List<ScheduleStrategyRunntime> from class com.taobao.pamirs.schedule.zk.ScheduleStrategyDataManager4ZK


    protected int loadScheduleData() {
        try {
            // 在每次数据处理完毕后休眠固定的时间
            if (this.taskTypeInfo.getSleepTimeInterval() > 0) {
                if (logger.isTraceEnabled()) {
                    logger.trace("处理完一批数据后休眠：" + this.taskTypeInfo.getSleepTimeInterval());
                }
                this.isSleeping = true;
                Thread.sleep(taskTypeInfo.getSleepTimeInterval());
                this.isSleeping = false;

                if (logger.isTraceEnabled()) {
                    logger.trace("处理完一批数据后休眠后恢复");
                }
            }

            List<TaskItemDefine> taskItems = this.scheduleManager.getCurrentScheduleTaskItemList();
            // 根据队列信息查询需要调度的数据，然后增加到任务列表中
            if (taskItems.size() > 0) {
                List<TaskItemDefine> tmpTaskList = new ArrayList<>();
                synchronized (taskItems) {
                    for (TaskItemDefine taskItemDefine : taskItems) {
                        tmpTaskList.add(taskItemDefine);
                    }
                }
                List<T> tmpList = this.taskDealBean
                    .selectTasks(taskTypeInfo.getTaskParameter(), scheduleManager.getScheduleServer().getOwnSign(),
                        this.scheduleManager.getTaskItemCount(), tmpTaskList, taskTypeInfo.getFetchDataNumber());
                scheduleManager.getScheduleServer()
                    .setLastFetchDataTime(new Timestamp(scheduleManager.scheduleCenter.getSystemTime()));
                if (tmpList != null) {
                    this.taskList.addAll(tmpList);
                }
            } else {
                if (logger.isTraceEnabled()) {
                    logger.trace("没有获取到需要处理的数据队列");
                }
            }
            addFetchNum(taskList.size(), "TBScheduleProcessor.loadScheduleData");
            return this.taskList.size();
        } catch (Throwable ex) {
            logger.error("Get tasks error.", ex);
        }
        return 0;
    }

    protected int loadScheduleData() {
        try {
            // 在每次数据处理完毕后休眠固定的时间
            if (this.taskTypeInfo.getSleepTimeInterval() > 0) {
                if (logger.isTraceEnabled()) {
                    logger.trace("处理完一批数据后休眠：" + this.taskTypeInfo.getSleepTimeInterval());
                }
                this.isSleeping = true;
                Thread.sleep(taskTypeInfo.getSleepTimeInterval());
                this.isSleeping = false;

                if (logger.isTraceEnabled()) {
                    logger.trace("处理完一批数据后休眠后恢复");
                }
            }

            List<TaskItemDefine> taskItems = this.scheduleManager.getCurrentScheduleTaskItemList();
            // 根据队列信息查询需要调度的数据，然后增加到任务列表中
            if (taskItems.size() > 0) {
                List<TaskItemDefine> tmpTaskList = new ArrayList<TaskItemDefine>();
                synchronized (taskItems) {
                    for (TaskItemDefine taskItemDefine : taskItems) {
                        tmpTaskList.add(taskItemDefine);
                    }
                }
                List<T> tmpList = this.taskDealBean
                    .selectTasks(taskTypeInfo.getTaskParameter(), scheduleManager.getScheduleServer().getOwnSign(),
                        this.scheduleManager.getTaskItemCount(), tmpTaskList, taskTypeInfo.getFetchDataNumber());
                scheduleManager.getScheduleServer()
                    .setLastFetchDataTime(new Timestamp(scheduleManager.scheduleCenter.getSystemTime()));
                if (tmpList != null) {
                    this.taskList.addAll(tmpList);
                }
            } else {
                if (logger.isTraceEnabled()) {
                    logger.trace("没有获取到需要处理的数据队列");
                }
            }
            addFetchNum(taskList.size(), "TBScheduleProcessor.loadScheduleData");
            return this.taskList.size();
        } catch (Throwable ex) {
            logger.error("Get tasks error.", ex);
        }
        return 0;
    }

Replace Generic With Diamond ArrayList<TaskItemDefine> with ArrayList<> in method protected loadScheduleData() : int from class com.taobao.pamirs.schedule.taskmanager.TBScheduleProcessorSleep


        SpanBuilder(String operationName) {
            this.operationName = operationName;
            this.tags = new HashMap<>();
        }

    SpanBuilder(String operationName) {
      this.operationName = operationName;
      this.tags = new HashMap<String, String>();
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method package SpanBuilder(operationName String) from class com.lightstep.tracer.shared.AbstractTracer.SpanBuilder


        public Status() {
            this.tags = new HashMap<>();
        }

    public Status() {
      this.tags = new HashMap<String, String>();
    }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public Status() from class com.lightstep.tracer.shared.AbstractTracer.Status


    public AbstractTracer(Options options) {
        // Set verbosity first so debug logs from the constructor take effect
        this.verbosity = options.verbosity;

        // TODO sanity check options
        this.maxBufferedSpans = options.maxBufferedSpans > 0 ?
                options.maxBufferedSpans : DEFAULT_MAX_BUFFERED_SPANS;
        this.lastNewSpanMillis = new AtomicLong(System.currentTimeMillis());
        this.spans = new ArrayList<>(maxBufferedSpans);

        this.clockState = new ClockState();
        this.clientMetrics = new ClientMetrics();
        this.visibleErrorCount = 0;

        this.auth = new Auth();
        auth.setAccess_token(options.accessToken);

        // Set some default attributes if not found in options
        if (options.tags.get(COMPONENT_NAME_KEY) == null) {
            // TODO: support other ways of setting component name by default
            String s = System.getProperty("sun.java.command");
            if (s != null) {
                StringTokenizer st = new StringTokenizer(s);
                if (st.hasMoreTokens()) {
                    String name = st.nextToken();
                    options.tags.put(COMPONENT_NAME_KEY, name);
                    options.tags.put(LEGACY_COMPONENT_NAME_KEY, name);
                }
            }
        }

        String guid;
        if (options.tags.get(GUID_KEY) == null) {
            guid = generateGUID();
            options.tags.put(GUID_KEY, guid);
        } else {
            guid = options.tags.get(GUID_KEY).toString();
        }

        this.runtime = new Runtime();
        this.runtime.setGuid(guid);
        // Unfortunately Java7 has no way to generate a timestamp that's both
        // precise (a la System.nanoTime()) and absolute (a la
        // System.currentTimeMillis()). We store an absolute start timestamp but at
        // least get a precise duration at Span.finish() time via
        // startTimestampRelativeNanos (search for it below).
        this.runtime.setStart_micros(this.nowMicrosApproximate());
        for (Map.Entry<String, Object> entry : options.tags.entrySet()) {
            this.addTracerTag(entry.getKey(), entry.getValue().toString());
        }

        String host = options.collectorHost != null ? options.collectorHost : DEFAULT_HOST;
        int port;
        String scheme = "https";
        if (options.collectorEncryption == Options.Encryption.NONE) {
            scheme = "http";
            port = options.collectorPort > 0 ? options.collectorPort : DEFAULT_PLAINTEXT_PORT;
        } else {
            port = options.collectorPort > 0 ? options.collectorPort : DEFAULT_SECURE_PORT;
        }
        try {
            this.collectorURL = new URL(scheme, host, port, COLLECTOR_PATH);
        } catch (MalformedURLException e) {
            this.error("Collector URL malformed. Disabling tracer.", e);
            // Preemptively disable this tracer.
            this.disable();
            return;
        }

        if (!options.disableReportingLoop) {
            long intervalMillis = options.maxReportingIntervalMillis > 0 ?
                    options.maxReportingIntervalMillis :
                    DEFAULT_REPORTING_INTERVAL_MILLIS;
            this.reportingLoop = new ReportingLoop(intervalMillis);
        }

        if (!options.disableReportOnExit) {
            java.lang.Runtime.getRuntime().addShutdownHook(new Thread() {
                public void run() {
                    AbstractTracer.this.debug("Running shutdown hook");
                    AbstractTracer.this.shutdown();
                }
            });
        } else {
            this.debug("Report at exit is disabled");
        }
    }

  public AbstractTracer(Options options) {
    // Set verbosity first so debug logs from the constructor take effect
    this.verbosity = options.verbosity;

    // TODO sanity check options
    this.maxBufferedSpans = options.maxBufferedSpans > 0 ?
      options.maxBufferedSpans : DEFAULT_MAX_BUFFERED_SPANS;
    this.lastNewSpanMillis = new AtomicLong(System.currentTimeMillis());
    this.spans = new ArrayList<SpanRecord>(maxBufferedSpans);

    this.clockState = new ClockState();
    this.clientMetrics = new ClientMetrics();
    this.visibleErrorCount = 0;

    this.auth = new Auth();
    auth.setAccess_token(options.accessToken);

    // Set some default attributes if not found in options
    if (options.tags.get(COMPONENT_NAME_KEY) == null) {
      // TODO: support other ways of setting component name by default
      String s = System.getProperty("sun.java.command");
      if (s != null) {
        StringTokenizer st = new StringTokenizer(s);
        if (st.hasMoreTokens()) {
          String name = st.nextToken();
          options.tags.put(COMPONENT_NAME_KEY, name);
          options.tags.put(LEGACY_COMPONENT_NAME_KEY, name);
        }
      }
    }

    String guid;
    if (options.tags.get(GUID_KEY) == null) {
      guid = generateGUID();
      options.tags.put(GUID_KEY, guid);
    } else {
      guid = options.tags.get(GUID_KEY).toString();
    }

    this.runtime = new Runtime();
    this.runtime.setGuid(guid);
    // Unfortunately Java7 has no way to generate a timestamp that's both
    // precise (a la System.nanoTime()) and absolute (a la
    // System.currentTimeMillis()). We store an absolute start timestamp but at
    // least get a precise duration at Span.finish() time via
    // startTimestampRelativeNanos (search for it below).
    this.runtime.setStart_micros(this.nowMicrosApproximate());
    for (Map.Entry<String, Object> entry : options.tags.entrySet()) {
      this.addTracerTag(entry.getKey(), entry.getValue().toString());
    }

    String host = options.collectorHost != null ? options.collectorHost : DEFAULT_HOST;
    int port;
    String scheme = "https";
    if (options.collectorEncryption == Options.Encryption.NONE) {
      scheme = "http";
      port = options.collectorPort > 0 ? options.collectorPort : DEFAULT_PLAINTEXT_PORT;
    } else {
      port = options.collectorPort > 0 ? options.collectorPort : DEFAULT_SECURE_PORT;
    }
    try {
      this.collectorURL = new URL(scheme, host, port, COLLECTOR_PATH);
    } catch (MalformedURLException e) {
      this.error("Collector URL malformed. Disabling tracer.", e);
      // Preemptively disable this tracer.
      this.disable();
      return;
    }

    if (!options.disableReportingLoop) {
        long intervalMillis = options.maxReportingIntervalMillis > 0 ?
	    options.maxReportingIntervalMillis :
	    DEFAULT_REPORTING_INTERVAL_MILLIS;
        this.reportingLoop = new ReportingLoop(intervalMillis);
    }

    if (!options.disableReportOnExit) {
      java.lang.Runtime.getRuntime().addShutdownHook(new Thread() {
        public void run() {
            AbstractTracer.this.debug("Running shutdown hook");
            AbstractTracer.this.shutdown();
        }
      });
    } else {
      this.debug("Report at exit is disabled");
    }
  }

Replace Generic With Diamond ArrayList<SpanRecord> with ArrayList<> in method public AbstractTracer(options Options) from class com.lightstep.tracer.shared.AbstractTracer


    /**
     * Disable the tracer, stopping any further reports and turning all
     * subsequent method invocations into no-ops.
     */
    public void disable() {
        this.info("Disabling client library");
        this.doStopReporting();

        synchronized (this.mutex) {
            if (this.transport != null) {
                this.transport.close();
                this.transport = null;
            }

            this.isDisabled = true;

            // The code makes various assumptions about this field never being
            // null, so replace it with an empty list rather than nulling it out.
            this.spans = new ArrayList<>(0);
        }
    }

  /**
   * Disable the tracer, stopping any further reports and turning all
   * subsequent method invocations into no-ops.
   */
  public void disable() {
    this.info("Disabling client library");
    this.doStopReporting();

    synchronized (this.mutex) {
      if (this.transport != null) {
        this.transport.close();
        this.transport = null;
      }

      this.isDisabled = true;

      // The code makes various assumptions about this field never being
      // null, so replace it with an empty list rather than nulling it out.
      this.spans = new ArrayList<SpanRecord>(0);
    }
  }

Replace Generic With Diamond ArrayList<SpanRecord> with ArrayList<> in method public disable() : void from class com.lightstep.tracer.shared.AbstractTracer


    public Metrics toThrift() {
        ArrayList<MetricsSample> counts = new ArrayList<>(NUMBER_OF_COUNTS);
        counts.add(new MetricsSample("spans.dropped").setInt64_value(spansDropped));
        return new Metrics().setCounts(counts);
    }

    public Metrics toThrift() {
        ArrayList<MetricsSample> counts = new ArrayList<MetricsSample>(NUMBER_OF_COUNTS);
        counts.add(new MetricsSample("spans.dropped").setInt64_value(spansDropped));
        return new Metrics().setCounts(counts);
    }

Replace Generic With Diamond ArrayList<MetricsSample> with ArrayList<> in method public toThrift() : Metrics from class com.lightstep.tracer.shared.ClientMetrics


    protected SimpleFuture<Boolean> flushInternal(boolean explicitRequest) {
        return new SimpleFuture<>(sendReport(explicitRequest));
    }

    protected SimpleFuture<Boolean> flushInternal(boolean explicitRequest) {
        return new SimpleFuture<Boolean>(sendReport(explicitRequest));
    }

Replace Generic With Diamond SimpleFuture<Boolean> with SimpleFuture<> in method protected flushInternal(explicitRequest boolean) : SimpleFuture<Boolean> from class com.lightstep.tracer.jre.JRETracer


    private <T> T postGetJson(String path, Class<T> cl) {
	try (BufferedReader br = new BufferedReader(new InputStreamReader(getUrlReader(path)))) {
	    return objectMapper.readValue(br, cl);
	} catch(IOException e) {
	    throw new RuntimeException(e);
	}
    }

    private <T> T getUrl(String path, Class<T> cl) {
	try {
	    URL u = new URL(baseUrl + path);
	    URLConnection c = u.openConnection();
	    c.setDoOutput(true);
	    c.setDoInput(true);
	    c.getOutputStream().close();

	    BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream()));
	    T obj = objectMapper.readValue(in, cl);
	    in.close();
	    return obj;
	} catch(MalformedURLException e) {
	    throw new RuntimeException(e);
	} catch(IOException e) {
	    throw new RuntimeException(e);
	}
    }

Try With Resources try(BufferedReader br=new BufferedReader(new InputStreamReader(getUrlReader(path)))) in method private postGetJson(path String, cl Class<T>) : T from class com.lightstep.benchmark.BenchmarkClient


  public static void print(Node tree) {
    if (tree == null) {
      return;
    }
    Queue<Pair<Integer, Node>> queue = new LinkedList<>() {{
      add(Pair.of(depth(tree) - 1, tree));
    }};
    while (!queue.isEmpty()) {
      int offset = 0;
      for (int i = queue.size(); i > 0; i--) {
        Pair<Integer, Node> node = queue.poll();
        assert node != null;
        String sep = "\t";
        System.out.print(StringUtil.repeat(sep, node.getLeft() - offset) + " " + node.getRight().val);

        if (node.getRight().left != null) {
          queue.add(Pair.of(node.getLeft() - 1, node.getRight().left));
        }
        if (node.getRight().right != null) {
          queue.add(Pair.of(node.getLeft() + 1, node.getRight().right));
        }
        offset = node.getLeft();
      }
      System.out.println();
    }
  }

    public static void print(Node tree) {
        if (tree == null) {
            return;
        }
        Queue<Pair<Integer, Node>> queue = new LinkedList<Pair<Integer, Node>>() {{
            add(Pair.of(depth(tree) - 1, tree));
        }};
        while (!queue.isEmpty()) {
            int offset = 0;
            for (int i = queue.size(); i > 0; i--) {
                Pair<Integer, Node> node = queue.poll();
                assert node != null;
                String sep = "\t";
                System.out.print(StringUtil.repeat(sep, node.getLeft() - offset) + " " + node.getRight().val);

                if (node.getRight().left != null) {
                    queue.add(Pair.of(node.getLeft() - 1, node.getRight().left));
                }
                if (node.getRight().right != null) {
                    queue.add(Pair.of(node.getLeft() + 1, node.getRight().right));
                }
                offset = node.getLeft();
            }
            System.out.println();
        }
    }

Replace Generic With Diamond LinkedList<Pair<Integer,Node>> with LinkedList<> in method public print(tree Node) : void from class cn.cstn.algorithm.commons.Node


  public static String serialize(Node root) {
    if (root == null) return "[]";

    StringBuilder res = new StringBuilder("[");
    Queue<Node> queue = new LinkedList<>() {{
      add(root);
    }};

    while (!queue.isEmpty()) {
      Node node = queue.poll();
      if (node != null) {
        res.append(node.val).append(",");
        queue.add(node.left);
        queue.add(node.right);
        continue;
      }
      res.append("null,");
    }
    res.deleteCharAt(res.length() - 1);

    res.append("]");
    return res.toString();
  }

    public static String serialize(Node root) {
        if (root == null) return "[]";

        StringBuilder res = new StringBuilder("[");
        Queue<Node> queue = new LinkedList<Node>() {{
            add(root);
        }};

        while (!queue.isEmpty()) {
            Node node = queue.poll();
            if (node != null) {
                res.append(node.val).append(",");
                queue.add(node.left);
                queue.add(node.right);
                continue;
            }
            res.append("null,");
        }
        res.deleteCharAt(res.length() - 1);

        res.append("]");
        return res.toString();
    }

Replace Generic With Diamond LinkedList<Node> with LinkedList<> in method public serialize(root Node) : String from class cn.cstn.algorithm.commons.Node


  public static Node deserialize(String data) {
    if (data == null || data.equals("[]")) return null;

    String[] vs = data.substring(1, data.length() - 1).split(",");
    Node root = new Node(Integer.parseInt(vs[0]));
    Queue<Node> queue = new LinkedList<>() {{
      add(root);
    }};
    int i = 1;
    while (!queue.isEmpty()) {
      Node node = queue.poll();
      if (!vs[i].equals("null")) {
        node.left = new Node(Integer.parseInt(vs[i]));
        queue.add(node.left);
      }
      i++;
      if (!vs[i].equals("null")) {
        node.right = new Node(Integer.parseInt(vs[i]));
        queue.add(node.right);
      }
      i++;
    }

    return root;
  }

    public static Node deserialize(String data) {
        if (data == null || data.equals("[]")) return null;

        String[] vs = data.substring(1, data.length() - 1).split(",");
        Node root = new Node(Integer.parseInt(vs[0]));
        Queue<Node> queue = new LinkedList<Node>() {{
            add(root);
        }};
        int i = 1;
        while (!queue.isEmpty()) {
            Node node = queue.poll();
            if (!vs[i].equals("null")) {
                node.left = new Node(Integer.parseInt(vs[i]));
                queue.add(node.left);
            }
            i++;
            if (!vs[i].equals("null")) {
                node.right = new Node(Integer.parseInt(vs[i]));
                queue.add(node.right);
            }
            i++;
        }

        return root;
    }

Replace Generic With Diamond LinkedList<Node> with LinkedList<> in method public deserialize(data String) : Node from class cn.cstn.algorithm.commons.Node


  public static List<List<Integer>> levelOrderII(Node root, boolean cross) {
    if (root == null) return new ArrayList<>();
    Queue<Node> queue = new LinkedList<>() {{
      add(root);
    }};
    List<List<Integer>> res = new ArrayList<>();

    int k = 1;
    while (!queue.isEmpty()) {
      LinkedList<Integer> tmp = new LinkedList<>();
      for (int i = queue.size(); i > 0; i--) {
        Node node = queue.poll();
        assert node != null;
        if (cross && k % 2 == 0) tmp.addFirst(node.val);
        else tmp.add(node.val);
        if (node.left != null) queue.add(node.left);
        if (node.right != null) queue.add(node.right);
      }
      res.add(tmp);
      k++;
    }

    return res;
  }

    public static List<List<Integer>> levelOrderII(Node root, boolean cross) {
        if (root == null) return new ArrayList<>();
        Queue<Node> queue = new LinkedList<Node>() {{
            add(root);
        }};
        List<List<Integer>> res = new ArrayList<>();

        int k = 1;
        while (!queue.isEmpty()) {
            LinkedList<Integer> tmp = new LinkedList<>();
            for (int i = queue.size(); i > 0; i--) {
                Node node = queue.poll();
                assert node != null;
                if (cross && k % 2 == 0) tmp.addFirst(node.val);
                else tmp.add(node.val);
                if (node.left != null) queue.add(node.left);
                if (node.right != null) queue.add(node.right);
            }
            res.add(tmp);
            k++;
        }

        return res;
    }

Replace Generic With Diamond LinkedList<Node> with LinkedList<> in method public levelOrderII(root Node, cross boolean) : List<List<Integer>> from class cn.cstn.algorithm.commons.Node


  public static int[] levelOrderI(Node root) {
    if (root == null) return new int[0];
    Queue<Node> queue = new LinkedList<>() {{
      add(root);
    }};
    List<Integer> list = new ArrayList<>();

    while (!queue.isEmpty()) {
      Node node = queue.poll();
      list.add(node.val);
      if (node.left != null) queue.add(node.left);
      if (node.right != null) queue.add(node.right);
    }

    int[] res = new int[list.size()];
    for (int i = 0; i < res.length; i++) {
      res[i] = list.get(i);
    }

    return res;
  }

    public static int[] levelOrderI(Node root) {
        if (root == null) return new int[0];
        Queue<Node> queue = new LinkedList<Node>() {{
            add(root);
        }};
        List<Integer> list = new ArrayList<>();

        while (!queue.isEmpty()) {
            Node node = queue.poll();
            list.add(node.val);
            if (node.left != null) queue.add(node.left);
            if (node.right != null) queue.add(node.right);
        }

        int[] res = new int[list.size()];
        for (int i = 0; i < res.length; i++) {
            res[i] = list.get(i);
        }

        return res;
    }

Replace Generic With Diamond LinkedList<Node> with LinkedList<> in method public levelOrderI(root Node) : int[] from class cn.cstn.algorithm.commons.Node


  public static Node _buildTree(int[] preOrder, int[] inOrder) {
    if (preOrder == null || preOrder.length == 0) return null;

    int inOrderIndex = 0;
    Node root = new Node(preOrder[0]);
    Stack<Node> stack = new Stack<>() {{
      push(root);
    }};
    for (int i = 1; i < preOrder.length; i++) {
      Node cur = new Node(preOrder[i]);
      Node node = stack.peek();
      if (node.val != inOrder[inOrderIndex]) {
        node.left = cur;
        stack.add(node.left);
      } else {
        while (!stack.isEmpty() && stack.peek().val == inOrder[inOrderIndex]) {
          node = stack.pop();
          inOrderIndex++;
        }
        node.right = cur;
        stack.add(node.right);
      }
    }
    return root;
  }

    public static Node _buildTree(int[] preOrder, int[] inOrder) {
        if (preOrder == null || preOrder.length == 0) return null;

        int inOrderIndex = 0;
        Node root = new Node(preOrder[0]);
        Stack<Node> stack = new Stack<Node>() {{
            push(root);
        }};
        for (int i = 1; i < preOrder.length; i++) {
            Node cur = new Node(preOrder[i]);
            Node node = stack.peek();
            if (node.val != inOrder[inOrderIndex]) {
                node.left = cur;
                stack.add(node.left);
            } else {
                while (!stack.isEmpty() && stack.peek().val == inOrder[inOrderIndex]) {
                    node = stack.pop();
                    inOrderIndex++;
                }
                node.right = cur;
                stack.add(node.right);
            }
        }
        return root;
    }

Replace Generic With Diamond Stack<Node> with Stack<> in method public _buildTree(preOrder int[], inOrder int[]) : Node from class cn.cstn.algorithm.commons.Node


    private Map<String, Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
        UmmalquraDateFormatSymbols symbols = new UmmalquraDateFormatSymbols(locale);
        String[] strings = getFieldStrings(field, style, symbols);
        if (strings != null) {
            Map<String, Integer> names = new HashMap<>();
            for (int i = 0; i < strings.length; i++) {
                if (strings[i].length() == 0) {
                    continue;
                }
                names.put(strings[i], i);
            }
            return names;
        }

        return null;
    }

    private Map<String, Integer> getDisplayNamesImpl(int field, int style, Locale locale) {
        UmmalquraDateFormatSymbols symbols = new UmmalquraDateFormatSymbols(locale);
        String[] strings = getFieldStrings(field, style, symbols);
        if (strings != null) {
            Map<String, Integer> names = new HashMap<String, Integer>();
            for (int i = 0; i < strings.length; i++) {
                if (strings[i].length() == 0) {
                    continue;
                }
                names.put(strings[i], i);
            }
            return names;
        }

        return null;
    }

Replace Generic With Diamond HashMap<String,Integer> with HashMap<> in method private getDisplayNamesImpl(field int, style int, locale Locale) : Map<String,Integer> from class com.github.msarhan.ummalqura.calendar.UmmalquraCalendar


  public static void main(String[] args) {
    String dir = "";
    for (int i = 0; i < args.length; i++) {
      if (args[i].equals("--directory")) {
        if (i + 1 >= args.length) {
          System.out.println("Please provide a directory");
          System.exit(1);
        }
        dir = args[i + 1];
      }
    }
    Socket clientSocket = null;
    try (ServerSocket serverSocket = new ServerSocket(4221)) {
      serverSocket.setReuseAddress(true);
      while (true) {
        clientSocket = serverSocket.accept(); // Wait for connection from client.
        System.out.println("Connection established");
        BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
        OutputStream out = clientSocket.getOutputStream();
        Url url = buildUrl(in);
        if ("POST".equals(url.getMethod())) {
          String res = handlePOST(url.requestLine, url.getHeaders(), url.getBody(), dir);
          out.write(res.getBytes());
        }
        if ("GET".equals(url.getMethod())) {
          String res = handleGET(url.requestLine, url.getHeaders(), url.body, dir);
          out.write(res.getBytes());
        }
        out.flush();
        out.close();
        in.close();
      }
    } catch (IOException e) {
      System.out.println("Error occurred");
      System.out.println("IOException: " + e.getMessage());
    }
  }

  public static void main(String[] args) {
    for (int i = 0; i < args.length; i++) {
      if (args[i].equals("--directory")) {
        if (i + 1 >= args.length) {
          System.out.println("Please provide a directory");
          System.exit(1);
        }
        dir = args[i + 1];
      }
    }
    ServerSocket serverSocket = null;
    Socket clientSocket = null;
    try {
      serverSocket = new ServerSocket(4221);
      serverSocket.setReuseAddress(true);
      while (true) {
        clientSocket = serverSocket.accept(); // Wait for connection from client.
        BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

        Url url = buildUrl("", in);
        String res = handleURLCheck(url.requestLine.split(" ")[1], url.headers, url.body);
        clientSocket.getOutputStream().write(res.getBytes());
        clientSocket.getOutputStream().flush();
        clientSocket.close();
      }
    } catch (IOException e) {
      System.out.println("IOException: " + e.getMessage());
    }
  }

Try With Resources try(ServerSocket serverSocket=new ServerSocket(4221)) in method public main(args String[]) : void from class Main


    /**
     * Starts the gui application
     *
     * @param primaryStage the Stage object which acts as the main window
     */
    @Override
    public void start(Stage primaryStage) {
        Thread.setDefaultUncaughtExceptionHandler(DSMApplication::handleError);

        Scene scene = new Scene(root, 1400, 800);
        primaryStage.setTitle("DSM Editor");
        primaryStage.setScene(scene);
        primaryStage.show();
        Platform.setImplicitExit(true);

        // start with a tab open (used for debugging, remove or comment out for release)
        if(cliArgs.contains("debug=true")) {
            File f = new File("/home/aiden/Documents/DSMEditor/test3.dsm");
            if(f.exists()) {
                SymmetricIOHandler ioHandler = new SymmetricIOHandler(f);
                SymmetricDSM matrix = ioHandler.readFile();
                editor.addTab(
                        matrix,
                        ioHandler,
                        new SymmetricMatrixHandler(matrix, 12.0),
                        new SymmetricHeaderMenu(editor),
                        new SymmetricSideBar(matrix, editor)
                );
            }
        }

        for (String cliArg : cliArgs) {
            System.out.println(cliArg);
        }

        // on close, iterate through each tab and run the close request to save it or not
        scene.getWindow().setOnCloseRequest(ev -> {
            for (Map.Entry<Tab, Integer> entry : ((HashMap<Tab, Integer>) editor.getTabs().clone()).entrySet()) {  // iterate over clone
                EventHandler<Event> handler = entry.getKey().getOnCloseRequest();
                handler.handle(null);

                if (editor.getTabs().get(entry.getKey()) != null) {
                    ev.consume();
                    return;
                }
            }
            System.exit(0);  // terminate the program once the window is closed
        });

        //FreezeGrid.debug2();

    }

    /**
     * Starts the gui application
     *
     * @param primaryStage the Stage object which acts as the main window
     */
    @Override
    public void start(Stage primaryStage) {
        Thread.setDefaultUncaughtExceptionHandler(DSMApplication::handleError);

        Scene scene = new Scene(root, 1400, 800);
        primaryStage.setTitle("DSM Editor");
        primaryStage.setScene(scene);
        primaryStage.show();
        Platform.setImplicitExit(true);

        // start with a tab open (used for debugging, remove or comment out for release)
        if(cliArgs.contains("debug=true")) {
            File f = new File("/home/aiden/Documents/DSMEditor/test3.dsm");
            if(f.exists()) {
                SymmetricIOHandler ioHandler = new SymmetricIOHandler(f);
                SymmetricDSM matrix = ioHandler.readFile();
                this.editor.addTab(
                        matrix,
                        ioHandler,
                        new SymmetricMatrixHandler(matrix, 12.0),
                        new SymmetricHeaderMenu(editor),
                        new SymmetricSideBar(matrix, editor)
                );
            }
        }

        for(int i=0; i<cliArgs.size(); i++) {
            System.out.println(cliArgs.get(i));
        }

        // on close, iterate through each tab and run the close request to save it or not
        scene.getWindow().setOnCloseRequest(new EventHandler<WindowEvent>() {
            public void handle(WindowEvent ev) {
                for (Map.Entry<Tab, Integer> entry : ((HashMap<Tab, Integer>) editor.getTabs().clone()).entrySet()) {  // iterate over clone
                    EventHandler<Event> handler = entry.getKey().getOnCloseRequest();
                    handler.handle(null);

                    if (editor.getTabs().get(entry.getKey()) != null) {
                        ev.consume();
                        return;
                    }
                }
                System.exit(0);  // terminate the program once the window is closed
            }
        });

//        FreezeGrid.debug();

    }

Replace Anonymous With Lambda .DSMApplication.start.setOnCloseRequest.new EventHandler<WindowEvent> with ev -> {for(Map.Entry<Tab,Integer> entry: ((HashMap<Tab,Integer>)editor.getTabs().clone()).entrySet()){EventHandler<Event> handler=entry.getKey().getOnCloseRequest(); in method public start(primaryStage Stage) : void from class DSMApplication


    /**
     * Creates the NumericTextField object and sets up callbacks to ensure only
     * numbers are entered in the area
     *
     * @param initialValue default text to display
     */
    public NumericTextField(Double initialValue) {
        if(initialValue != null) {
            numericValue = new SimpleDoubleProperty(initialValue);
            setText(initialValue.toString());
        } else {
            numericValue = new SimpleDoubleProperty();
            setText("");
        }

        final NumericTextField numericTextField = this;
        this.textProperty().addListener((observableValue, oldValue, newValue) -> {
            if (newValue == null || "".equals(newValue)) {
                setNumericValue(null);
                return;
            }

            int numPeriods = 0;
            StringBuilder modifiedValue = new StringBuilder();
            for (int i = 0; i < newValue.length(); i++) {  // rebuild the string with no characters that are not numeric or have multiple decimal places
                if (newValue.charAt(i) == '.') {
                    numPeriods += 1;
                    if (numPeriods > 1) {
                        modifiedValue.append("");
                    } else {
                        modifiedValue.append(".");
                    }
                } else if (!"0123456789".contains(String.valueOf(newValue.charAt(i)))) { // char is not numeric and should be removed
                    modifiedValue.append("");
                } else {
                    modifiedValue.append(newValue.charAt(i));
                }
            }

            if(!"".equals(modifiedValue.toString()) && !".".equals(modifiedValue.toString())) {
                numericValue.set(Double.parseDouble(modifiedValue.toString()));
            }
            numericTextField.setText(modifiedValue.toString());
        });
    }

    /**
     * Creates the NumericTextField object and sets up callbacks to ensure only
     * numbers are entered in the area
     *
     * @param initialValue default text to display
     */
    public NumericTextField(Double initialValue) {
        if(initialValue != null) {
            numericValue = new SimpleDoubleProperty(initialValue);
            setText(initialValue.toString());
        } else {
            numericValue = new SimpleDoubleProperty();
            setText("");
        }

        final NumericTextField numericTextField = this;
        this.textProperty().addListener(new ChangeListener<String>() {
            @Override
            public void changed(ObservableValue<? extends String> observableValue, String oldValue, String newValue) {
                if (newValue == null || "".equals(newValue)) {
                    setNumericValue(null);
                    return;
                }

                int numPeriods = 0;
                StringBuilder modifiedValue = new StringBuilder();
                for (int i = 0; i < newValue.length(); i++) {  // rebuild the string with no characters that are not numeric or have multiple decimal places
                    if (newValue.charAt(i) == '.') {
                        numPeriods += 1;
                        if (numPeriods > 1) {
                            modifiedValue.append("");
                        } else {
                            modifiedValue.append(".");
                        }
                    } else if (!"0123456789".contains(String.valueOf(newValue.charAt(i)))) { // char is not numeric and should be removed
                        modifiedValue.append("");
                    } else {
                        modifiedValue.append(newValue.charAt(i));
                    }
                }

                if(!"".equals(modifiedValue.toString()) && !".".equals(modifiedValue.toString())) {
                    numericValue.set(Double.parseDouble(modifiedValue.toString()));
                }
                numericTextField.setText(modifiedValue.toString());
            }
        });
    }

Replace Anonymous With Lambda View.Widgets.NumericTextField.NumericTextField.addListener.new ChangeListener<String> with (observableValue, oldValue, newValue) -> {if(newValue == null || "".equals(newValue)){setNumericValue(null); in method public NumericTextField(initialValue Double) from class View.Widgets.NumericTextField


            public ListCell<Integer> call(ListView<Integer> l) {
                return new ListCell<>() {
                    @Override
                    protected void updateItem(Integer item, boolean empty) {
                        super.updateItem(item, empty);
                        if (item == null || empty) {
                            setText(null);
                            setGraphic(null);
                        } else {
                            setText(matrix.getItem(item).getName().getValue());
                        }
                    }
                };
            }

            public ListCell<Integer> call(ListView<Integer> l) {
                return new ListCell<Integer>() {
                    @Override
                    protected void updateItem(Integer item, boolean empty) {
                        super.updateItem(item, empty);
                        if (item == null || empty) {
                            setText(null);
                            setGraphic(null);
                        } else {
                            setText(matrix.getItem(item).getName().getValue());
                        }
                    }
                };
            }

Replace Generic With Diamond ListCell<Integer> with ListCell<> in method public call(l ListView<Integer>) : ListCell<Integer> from class View.PropagationAnalysisWindow.updateConfigWidgets.cellFactory.new Callback<>


    /**
     * Updates the widgets on the side panel for parameter setting. Called from constructor.
     */
    private void updateConfigWidgets() {
        // function to set text of comboBox items, used for all ComboBoxes
        Callback<ListView<Integer>, ListCell<Integer>> cellFactory = new Callback<>() {
            public ListCell<Integer> call(ListView<Integer> l) {
                return new ListCell<>() {
                    @Override
                    protected void updateItem(Integer item, boolean empty) {
                        super.updateItem(item, empty);
                        if (item == null || empty) {
                            setText(null);
                            setGraphic(null);
                        } else {
                            setText(matrix.getItem(item).getName().getValue());
                        }
                    }
                };
            }
        };

    // start item and label
        VBox startItemLayout = new VBox();
        Label startItemLabel = new Label("Start Item");
        startItemEntry = new ComboBox<>();

        startItemEntry.setButtonCell(cellFactory.call(null));
        startItemEntry.setCellFactory(cellFactory);
        ArrayList<Integer> items = new ArrayList<>();
        for(DSMItem row : matrix.getRows()) {
            items.add(row.getUid());
        }

        startItemEntry.getItems().addAll(items);
        startItemEntry.setMaxWidth(Double.MAX_VALUE);
        startItemEntry.getSelectionModel().selectFirst();
        HBox.setHgrow(startItemEntry, Priority.ALWAYS);
        startItemLayout.getChildren().addAll(startItemLabel, startItemEntry);
        startItemLayout.setSpacing(5);
        startItemLayout.setPadding(new Insets(10));
        startItemLayout.setAlignment(Pos.CENTER);

    // num levels layout
        VBox numLevelsLayout = new VBox();

        Label numLevelsDescriptorLabel = new Label("Number of Levels to Run");

        HBox numLevelsModifierLayout = new HBox();
        numLevels = new SimpleIntegerProperty(1);

        Button decrease = new Button("-");
        decrease.setOnAction(e -> {
            if(numLevels.getValue() > 1) {
                numLevels.setValue(numLevels.getValue() - 1);
            }
        });
        Button increase = new Button("+");
        increase.setOnAction(e -> {
            if(numLevels.getValue() < 10) {
                numLevels.setValue(numLevels.getValue() + 1);
            }
        });

        Label numLevelsLabel = new Label("1");
        numLevelsLabel.textProperty().bind(numLevels.asString());
        HBox.setHgrow(numLevelsLabel, Priority.ALWAYS);

        numLevelsModifierLayout.getChildren().addAll(decrease, numLevelsLabel, increase);
        numLevelsModifierLayout.setSpacing(5);
        numLevelsModifierLayout.setAlignment(Pos.CENTER);

        numLevelsLayout.getChildren().addAll(numLevelsDescriptorLabel, numLevelsModifierLayout);
        numLevelsLayout.setSpacing(5);
        numLevelsLayout.setPadding(new Insets(10));
        numLevelsLayout.setAlignment(Pos.CENTER);

    // min weight layout
        VBox minWeightLayout = new VBox();

        Label minWeightLabel = new Label("Minimum Weight");

        minWeight = new SimpleDoubleProperty(1.0);
        NumericTextField minWeightEntry = new NumericTextField(minWeight.getValue());
        minWeightEntry.textProperty().addListener((obs, oldText, newText) -> minWeight.setValue(minWeightEntry.getNumericValue()));

        minWeightLayout.getChildren().addAll(minWeightLabel, minWeightEntry);
        minWeightLayout.setSpacing(5);
        minWeightLayout.setPadding(new Insets(10));
        minWeightLayout.setAlignment(Pos.CENTER);

    // count method layout
        VBox countMethodLayout = new VBox();
        countMethodLayout.setSpacing(10);

        Label countMethodLabel = new Label("Count Method");

        ToggleGroup tg = new ToggleGroup();
        RadioButton countByWeight = new RadioButton("Count by Weight");
        countByWeight.setToggleGroup(tg);
        countByWeight.setSelected(false);
        countByWeight.setMaxWidth(Double.MAX_VALUE);

        countByOccurrence = new RadioButton("Count By Occurrence");
        countByOccurrence.setToggleGroup(tg);
        countByOccurrence.setSelected(true);
        countByOccurrence.setMaxWidth(Double.MAX_VALUE);

        countMethodLayout.getChildren().addAll(countMethodLabel, countByOccurrence, countByWeight);
        countMethodLayout.setAlignment(Pos.CENTER);
        countMethodLayout.setPadding(new Insets(10));

    // exclusions layout
        VBox exclusionsLayout = new VBox();

        Label exclusionsLabel = new Label("Excluded Items");
        itemExclusions = new ListView<>();
        itemExclusions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        itemExclusions.setCellFactory(cellFactory);
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> itemExclusions.getItems().removeAll(itemExclusions.getSelectionModel().getSelectedItems()));

        HBox exceptionSelectorLayout = new HBox();
        ComboBox<Integer> itemExceptionSelector = new ComboBox<>();
        itemExceptionSelector.setButtonCell(cellFactory.call(null));
        itemExceptionSelector.setCellFactory(cellFactory);

        ArrayList<Integer> exceptions = new ArrayList<>();
        for(DSMItem row : matrix.getRows()) {
            exceptions.add(row.getUid());
        }

        itemExceptionSelector.getItems().addAll(exceptions);
        itemExceptionSelector.setMaxWidth(Double.MAX_VALUE);
        HBox.setHgrow(itemExceptionSelector, Priority.ALWAYS);
        itemExceptionSelector.setPromptText("Exclusion");

        Button addException = new Button("Add Exclusion");
        addException.setOnAction(e -> {
            if(itemExceptionSelector.getValue() == null || itemExclusions.getItems().contains(itemExceptionSelector.getValue())) return;
            itemExclusions.getItems().add(itemExceptionSelector.getValue());
        });

        exceptionSelectorLayout.getChildren().addAll(itemExceptionSelector, addException);

        exclusionsLayout.getChildren().addAll(exclusionsLabel, itemExclusions, deleteSelected, exceptionSelectorLayout);
        exclusionsLayout.setPadding(new Insets(10));
        exclusionsLayout.setAlignment(Pos.CENTER);
        exclusionsLayout.setSpacing(5);

    // add to config layout
        configLayout = new VBox();
        configLayout.getChildren().addAll(startItemLayout, numLevelsLayout, minWeightLayout, countMethodLayout, exclusionsLayout);
        configLayout.setSpacing(15);
        configLayout.setAlignment(Pos.CENTER);
    }

    /**
     * Updates the widgets on the side panel for parameter setting. Called from constructor.
     */
    private void updateConfigWidgets() {
        // function to set text of comboBox items, used for all ComboBoxes
        Callback<ListView<Integer>, ListCell<Integer>> cellFactory = new Callback<ListView<Integer>, ListCell<Integer>>() {
            public ListCell<Integer> call(ListView<Integer> l) {
                return new ListCell<Integer>() {
                    @Override
                    protected void updateItem(Integer item, boolean empty) {
                        super.updateItem(item, empty);
                        if (item == null || empty) {
                            setText(null);
                            setGraphic(null);
                        } else {
                            setText(matrix.getItem(item).getName().getValue());
                        }
                    }
                };
            }
        };

    // start item and label
        VBox startItemLayout = new VBox();
        Label startItemLabel = new Label("Start Item");
        startItemEntry = new ComboBox<>();

        startItemEntry.setButtonCell(cellFactory.call(null));
        startItemEntry.setCellFactory(cellFactory);
        ArrayList<Integer> items = new ArrayList<>();
        for(DSMItem row : matrix.getRows()) {
            items.add(row.getUid());
        }

        startItemEntry.getItems().addAll(items);
        startItemEntry.setMaxWidth(Double.MAX_VALUE);
        startItemEntry.getSelectionModel().selectFirst();
        HBox.setHgrow(startItemEntry, Priority.ALWAYS);
        startItemLayout.getChildren().addAll(startItemLabel, startItemEntry);
        startItemLayout.setSpacing(5);
        startItemLayout.setPadding(new Insets(10));
        startItemLayout.setAlignment(Pos.CENTER);

    // num levels layout
        VBox numLevelsLayout = new VBox();

        Label numLevelsDescriptorLabel = new Label("Number of Levels to Run");

        HBox numLevelsModifierLayout = new HBox();
        numLevels = new SimpleIntegerProperty(1);

        Button decrease = new Button("-");
        decrease.setOnAction(e -> {
            if(numLevels.getValue() > 1) {
                numLevels.setValue(numLevels.getValue() - 1);
            }
        });
        Button increase = new Button("+");
        increase.setOnAction(e -> {
            if(numLevels.getValue() < 10) {
                numLevels.setValue(numLevels.getValue() + 1);
            }
        });

        Label numLevelsLabel = new Label("1");
        numLevelsLabel.textProperty().bind(numLevels.asString());
        HBox.setHgrow(numLevelsLabel, Priority.ALWAYS);

        numLevelsModifierLayout.getChildren().addAll(decrease, numLevelsLabel, increase);
        numLevelsModifierLayout.setSpacing(5);
        numLevelsModifierLayout.setAlignment(Pos.CENTER);

        numLevelsLayout.getChildren().addAll(numLevelsDescriptorLabel, numLevelsModifierLayout);
        numLevelsLayout.setSpacing(5);
        numLevelsLayout.setPadding(new Insets(10));
        numLevelsLayout.setAlignment(Pos.CENTER);

    // min weight layout
        VBox minWeightLayout = new VBox();

        Label minWeightLabel = new Label("Minimum Weight");

        minWeight = new SimpleDoubleProperty(1.0);
        NumericTextField minWeightEntry = new NumericTextField(minWeight.getValue());
        minWeightEntry.textProperty().addListener((obs, oldText, newText) -> {
            minWeight.setValue(minWeightEntry.getNumericValue());
        });

        minWeightLayout.getChildren().addAll(minWeightLabel, minWeightEntry);
        minWeightLayout.setSpacing(5);
        minWeightLayout.setPadding(new Insets(10));
        minWeightLayout.setAlignment(Pos.CENTER);

    // count method layout
        VBox countMethodLayout = new VBox();
        countMethodLayout.setSpacing(10);

        Label countMethodLabel = new Label("Count Method");

        tg = new ToggleGroup();
        countByWeight = new RadioButton("Count by Weight");
        countByWeight.setToggleGroup(tg);
        countByWeight.setSelected(false);
        countByWeight.setMaxWidth(Double.MAX_VALUE);

        countByOccurrence = new RadioButton("Count By Occurrence");
        countByOccurrence.setToggleGroup(tg);
        countByOccurrence.setSelected(true);
        countByOccurrence.setMaxWidth(Double.MAX_VALUE);

        countMethodLayout.getChildren().addAll(countMethodLabel, countByOccurrence, countByWeight);
        countMethodLayout.setAlignment(Pos.CENTER);
        countMethodLayout.setPadding(new Insets(10));

    // exclusions layout
        VBox exclusionsLayout = new VBox();

        Label exclusionsLabel = new Label("Excluded Items");
        itemExclusions = new ListView<>();
        itemExclusions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        itemExclusions.setCellFactory(cellFactory);
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            itemExclusions.getItems().removeAll(itemExclusions.getSelectionModel().getSelectedItems());
        });

        HBox exceptionSelectorLayout = new HBox();
        ComboBox<Integer> itemExceptionSelector = new ComboBox<>();
        itemExceptionSelector.setButtonCell(cellFactory.call(null));
        itemExceptionSelector.setCellFactory(cellFactory);

        ArrayList<Integer> exceptions = new ArrayList<>();
        for(DSMItem row : matrix.getRows()) {
            exceptions.add(row.getUid());
        }

        itemExceptionSelector.getItems().addAll(exceptions);
        itemExceptionSelector.setMaxWidth(Double.MAX_VALUE);
        HBox.setHgrow(itemExceptionSelector, Priority.ALWAYS);
        itemExceptionSelector.setPromptText("Exclusion");

        Button addException = new Button("Add Exclusion");
        addException.setOnAction(e -> {
            if(itemExceptionSelector.getValue() == null || itemExclusions.getItems().contains(itemExceptionSelector.getValue())) return;
            itemExclusions.getItems().add(itemExceptionSelector.getValue());
        });

        exceptionSelectorLayout.getChildren().addAll(itemExceptionSelector, addException);

        exclusionsLayout.getChildren().addAll(exclusionsLabel, itemExclusions, deleteSelected, exceptionSelectorLayout);
        exclusionsLayout.setPadding(new Insets(10));
        exclusionsLayout.setAlignment(Pos.CENTER);
        exclusionsLayout.setSpacing(5);

    // add to config layout
        configLayout = new VBox();
        configLayout.getChildren().addAll(startItemLayout, numLevelsLayout, minWeightLayout, countMethodLayout, exclusionsLayout);
        configLayout.setSpacing(15);
        configLayout.setAlignment(Pos.CENTER);
    }

Replace Generic With Diamond ListCell<Integer> with ListCell<> in method private updateConfigWidgets() : void from class View.PropagationAnalysisWindow


    /**
     * Sets up the button for appending connections to the matrix
     */
    @Override
    protected void appendConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Append Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName().getValue());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName().getValue());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener((ob, o, n) -> {  // o is old value, n is new value
            RadioButton rb = (RadioButton)tg.getSelectedToggle();
            if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                itemSelector.getItems().removeAll(itemSelector.getItems());
                itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows
            } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                itemSelector.getItems().removeAll(itemSelector.getItems());
                itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns
            } else {  // clear all items
                itemSelector.getItems().removeAll(itemSelector.getItems());
            }
        });

        itemSelector.valueProperty().addListener((options, oldValue, newValue) -> {
            RadioButton rb = (RadioButton)tg.getSelectedToggle();
            connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
            connections.clear();
            if (rb.equals(selectByRow)) {  // clear all items and add rows to it
                for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && col.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(col.getName().getValue());
                    CheckBox box = new CheckBox();
                    connections.put(box, col);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            } else if (rb.equals(selectByCol)) {
                for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && row.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(row.getName().getValue());
                    CheckBox box = new CheckBox();
                    connections.put(box, row);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            }
        });

        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {  // rowUid | colUid | name | weight
               matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

    /**
     * Sets up the button for appending connections to the matrix
     */
    @Override
    protected void appendConnectionsCallback() {
        Stage window = new Stage();

        // Create Root window
        window.initModality(Modality.APPLICATION_MODAL); //Block events to other windows
        window.setTitle("Append Connections");

        // Create changes view (does not have button to remove items from it
        Label label = new Label("Changes to be made");
        ListView<DSMConnection> changesToMakeView = new ListView<>();
        changesToMakeView.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
        changesToMakeView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMConnection connection, boolean empty) {
                super.updateItem(connection, empty);

                if (empty || connection == null) {
                    setText(null);
                } else {
                    setText(
                        matrix.getItem(connection.getRowUid()).getName() + " (Row):" +
                        matrix.getItem(connection.getColUid()).getName() + " (Col)" +
                        "  {" + connection.getConnectionName() + ", " + connection.getWeight() + "}"
                    );
                }
            }
        });
        Button deleteSelected = new Button("Delete Selected Item(s)");
        deleteSelected.setOnAction(ee -> {
            changesToMakeView.getItems().removeAll(changesToMakeView.getSelectionModel().getSelectedItems());
        });

        // area to interact with the connections
        HBox connectionsArea = new HBox();
        connectionsArea.setSpacing(10);
        connectionsArea.setPadding(new Insets(10, 10, 10, 10));

        // HBox area full of checklists to modify the connections, default to columns
        HBox connectionsModifier = new HBox();
        connectionsModifier.setSpacing(10);
        connectionsModifier.setPadding(new Insets(10, 10, 10, 10));
        HashMap<CheckBox, DSMItem> connections = new HashMap<>();

        for(DSMItem conn : matrix.getCols()) {  // will default to choosing a row item so populate the scroll window with the columns
            VBox connectionVBox = new VBox();
            connectionVBox.setAlignment(Pos.CENTER);

            Label name = new Label(conn.getName().getValue());
            CheckBox box = new CheckBox();
            connections.put(box, conn);
            connectionVBox.getChildren().addAll(name, box);
            connectionsModifier.getChildren().add(connectionVBox);
        }
        ScrollPane scrollPane = new ScrollPane(connectionsModifier);
        scrollPane.setOnScroll(event -> {  // allow vertical scrolling to scroll horizontally
            if(event.getDeltaX() == 0 && event.getDeltaY() != 0) {
                scrollPane.setHvalue(scrollPane.getHvalue() - event.getDeltaY() / connectionsModifier.getWidth());
            }
        });
        scrollPane.setFitToHeight(true);

        // vbox to choose row or column
        VBox itemSelectorView = new VBox();
        itemSelectorView.setMinWidth(Region.USE_PREF_SIZE);

        // ComboBox to choose which row or column to modify connections of
        ComboBox< DSMItem > itemSelector = new ComboBox<>();  // rowUid | colUid | name | weight
        itemSelector.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(DSMItem item, boolean empty) {
                super.updateItem(item, empty);

                if (empty || item == null) {
                    setText(null);
                } else {
                    setText(item.getName().getValue());
                }
            }
        });

        itemSelector.getItems().addAll(matrix.getRows());  // default to choosing a row item

        Label l = new Label("Create connections by row or column?");
        l.setWrapText(true);
        l.prefWidthProperty().bind(itemSelector.widthProperty());  // this will make sure the label will not be bigger than the biggest object
        VBox.setVgrow(l, Priority.ALWAYS);
        HBox.setHgrow(l, Priority.ALWAYS);
        l.setMinHeight(Region.USE_PREF_SIZE);  // make sure all text will be displayed

        // radio buttons
        HBox rowColRadioButtons = new HBox();
        HBox.setHgrow(rowColRadioButtons, Priority.ALWAYS);
        rowColRadioButtons.setSpacing(10);
        rowColRadioButtons.setPadding(new Insets(10, 10, 10, 10));
        rowColRadioButtons.setMinHeight(Region.USE_PREF_SIZE);

        ToggleGroup tg = new ToggleGroup();
        RadioButton selectByRow = new RadioButton("Row");
        RadioButton selectByCol = new RadioButton("Column");
        HBox.setHgrow(selectByRow, Priority.ALWAYS);
        HBox.setHgrow(selectByCol, Priority.ALWAYS);
        selectByRow.setMinHeight(Region.USE_PREF_SIZE);
        selectByCol.setMinHeight(Region.USE_PREF_SIZE);

        selectByRow.setToggleGroup(tg);  // add RadioButtons to toggle group
        selectByCol.setToggleGroup(tg);
        selectByRow.setSelected(true);  // default to selectByRow

        // add a change listener
        tg.selectedToggleProperty().addListener(new ChangeListener<Toggle>() {
            public void changed(ObservableValue<? extends Toggle> ob, Toggle o, Toggle n) {
                RadioButton rb = (RadioButton)tg.getSelectedToggle();
                if(rb.equals(selectByRow)) {  // clear all items and add rows to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getRows());  // populate combobox with the rows
                } else if(rb.equals(selectByCol)) {  // clear all items and add cols to it
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                    itemSelector.getItems().addAll(matrix.getCols());  // populate combobox with the columns
                } else {  // clear all items
                    itemSelector.getItems().removeAll(itemSelector.getItems());
                }
            }
        });

        itemSelector.valueProperty().addListener((options, oldValue, newValue) -> {
            RadioButton rb = (RadioButton)tg.getSelectedToggle();
            connectionsModifier.getChildren().removeAll(connectionsModifier.getChildren());
            connections.clear();
            if (rb.equals(selectByRow)) {  // clear all items and add rows to it
                for(DSMItem col : matrix.getCols()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && col.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(col.getName().getValue());
                    CheckBox box = new CheckBox();
                    connections.put(box, col);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            } else if (rb.equals(selectByCol)) {
                for(DSMItem row : matrix.getRows()) {  // create the checkboxes
                    if(itemSelector.getValue() != null && row.getAliasUid().equals(itemSelector.getValue().getUid())) {  // don't allow creating connections between same row and column pair
                        continue;
                    }
                    VBox connectionVBox = new VBox();
                    connectionVBox.setAlignment(Pos.CENTER);

                    Label name = new Label(row.getName().getValue());
                    CheckBox box = new CheckBox();
                    connections.put(box, row);
                    connectionVBox.getChildren().addAll(name, box);
                    connectionsModifier.getChildren().add(connectionVBox);
                }
            }
        });

        rowColRadioButtons.getChildren().addAll(selectByRow, selectByCol);
        itemSelectorView.getChildren().addAll(l, rowColRadioButtons, itemSelector);

        // area to set details for the connection
        VBox connectionDetailsLayout = new VBox();
        connectionDetailsLayout.setSpacing(10);
        connectionDetailsLayout.setPadding(new Insets(10, 10, 10, 10));
        VBox.setVgrow(connectionDetailsLayout, Priority.ALWAYS);
        connectionDetailsLayout.setMinWidth(Region.USE_PREF_SIZE);

        TextField connectionName = new TextField();
        NumericTextField weight = new NumericTextField(null);
        connectionName.setPromptText("Connection Name");
        weight.setPromptText("Connection Weight");
        connectionName.setMinWidth(connectionName.getPrefWidth());
        weight.setMinWidth(weight.getPrefWidth());

        connectionDetailsLayout.getChildren().addAll(connectionName, weight);

        connectionsArea.getChildren().addAll(itemSelectorView, scrollPane, MiscWidgets.getHorizontalSpacer(), connectionDetailsLayout);

        // Pane to modify the connections
        HBox modifyPane = new HBox();
        modifyPane.setAlignment(Pos.CENTER);

        Button applyButton = new Button("Modify Connections");
        applyButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                // TODO: add popup window saying why it cannot make the changes
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), itemSelector.getValue().getUid(), entry.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }

                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMConnection conn = new DSMConnection(connectionName.getText(), weight.getNumericValue(), entry.getValue().getUid(), itemSelector.getValue().getUid());
                        if(!changesToMakeView.getItems().contains(conn)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn);
                        }
                    }
                }
            }
        });

        Button applySymmetricButton = new Button("Modify Connections Symmetrically");
        applySymmetricButton.setOnAction(ee -> {
            if(itemSelector.getValue() == null || connectionName.getText().isEmpty() || weight.getText().isEmpty()) {  // ensure connection can be added
                return;
            }
            for (Map.Entry<CheckBox, DSMItem> entry : connections.entrySet()) {
                if(entry.getKey().isSelected()) {
                    if(tg.getSelectedToggle().equals(selectByRow)) {  // selecting by row
                        DSMItem rowItem = matrix.getItem(itemSelector.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(entry.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    } else if(tg.getSelectedToggle().equals(selectByCol)) {  // selecting by column
                        DSMItem rowItem = matrix.getItem(entry.getValue().getUid());
                        DSMItem colItem = matrix.getItemByAlias(itemSelector.getValue().getUid());
                        DSMItem symmetricRowItem = matrix.getItemByAlias(rowItem.getUid());
                        DSMItem symmetricColItem = matrix.getItemByAlias(colItem.getUid());

                        DSMConnection conn1 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), rowItem.getUid(), colItem.getUid());
                        DSMConnection conn2 = new DSMConnection(connectionName.getText(), weight.getNumericValue(), symmetricRowItem.getUid(), symmetricColItem.getUid());

                        if(!changesToMakeView.getItems().contains(conn1)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn1);
                        }
                        if(!changesToMakeView.getItems().contains(conn2)) {  // ensure no duplicates
                            changesToMakeView.getItems().add(conn2);
                        }
                    }
                }
            }
        });
        modifyPane.getChildren().addAll(applyButton, applySymmetricButton);

        // create HBox for user to close with our without changes
        HBox closeArea = new HBox();
        Button applyAllButton = new Button("Apply All Changes");
        applyAllButton.setOnAction(ee -> {
            for(DSMConnection conn : changesToMakeView.getItems()) {  // rowUid | colUid | name | weight
               matrix.modifyConnection(conn.getRowUid(), conn.getColUid(), conn.getConnectionName(), conn.getWeight());
            }
            window.close();
            editor.refreshTab();
            matrix.setCurrentStateAsCheckpoint();
        });

        Button cancelButton = new Button("Cancel");
        cancelButton.setOnAction(ee -> {
            window.close();
        });
        closeArea.getChildren().addAll(cancelButton, MiscWidgets.getHorizontalSpacer(), applyAllButton);

        VBox layout = new VBox(10);
        layout.getChildren().addAll(label, changesToMakeView, deleteSelected, connectionsArea, modifyPane, MiscWidgets.getVerticalSpacer(), closeArea);
        layout.setAlignment(Pos.CENTER);
        layout.setPadding(new Insets(10, 10, 10, 10));
        layout.setSpacing(10);

        //Display window and wait for it to be closed before returning
        Scene scene = new Scene(layout, 900, 500);
        window.setScene(scene);
        window.showAndWait();
    }

Replace Anonymous With Lambda View.SideBarTools.SymmetricSideBar.appendConnectionsCallback.addListener.new ChangeListener<Toggle> with (ob, o, n) -> {RadioButton rb=(RadioButton)tg.getSelectedToggle(); in method protected appendConnectionsCallback() : void from class View.SideBarTools.SymmetricSideBar