    static Collector<Integer, List<Integer>, Mapping> collector() {
        return new Collector<Integer, List<Integer>, Mapping>() {
            @Override
            public Supplier<List<Integer>> supplier() {
                return ArrayList::new;
            }

            @Override
            public BiConsumer<List<Integer>, Integer> accumulator() {
                return List::add;
            }

            @Override
            public BinaryOperator<List<Integer>> combiner() {
                return (list1, list2) -> {
                    list1.addAll(list2);
                    return list1;
                };
            }

            @Override
            public Function<List<Integer>, Mapping> finisher() {
                return Mapping::wrap;
            }

            @Override
            public Set<Characteristics> characteristics() {
                return new HashSet<>();
            }
        };
    }

Replace Generic With Diamond Collector<Integer,List<Integer>,Mapping> with Collector<> in method public collector() : Collector<Integer,IntList,Mapping> from class rapaio.data.Mapping


    @SafeVarargs
    public static Comparator<Integer> aggregateComparator(final Comparator<Integer>... comparators) {
        return (row1, row2) -> {
            for (Comparator<Integer> comparator : comparators) {
                int comp = comparator.compare(row1, row2);
                if (comp != 0) {
                    return comp;
                }
            }
            return 0;
        };
    }

    @SafeVarargs
    public static Comparator<Integer> aggregateComparator(final Comparator<Integer>... comparators) {
        return new Comparator<Integer>() {
            @Override
            public int compare(Integer row1, Integer row2) {
                for (Comparator<Integer> comparator : comparators) {
                    int comp = comparator.compare(row1, row2);
                    if (comp != 0) {
                        return comp;
                    }
                }
                return 0;
            }
        };
    }

Replace Anonymous With Lambda rapaio.data.RowComparators.aggregateComparator.new Comparator<Integer> with (row1, row2) -> {for(Comparator<Integer> comparator: comparators){int comp=comparator.compare(row1,row2); in method public aggregateComparator(comparators Comparator<Integer>...) : Comparator<Integer> from class rapaio.data.RowComparators


    @Override
    public void learn(Frame df, Var weights, String... targetVarNames) {

        List<String> targetVarsList = new VarRange(targetVarNames).parseVarNames(df);
        if (targetVarsList.size() != 1) {
            throw new IllegalArgumentException("Forest classifiers can learn only one target variable");
        }
        this.targetNames = targetVarsList.toArray(new String[targetVarsList.size()]);
        this.dict = new HashMap<>();
        this.dict.put(firstTargetName(), df.var(firstTargetName()).dictionary());

        predictors.clear();

        totalOobInstances = 0;
        totalOobError = 0;

        IntStream.range(0, runs).parallel().forEach(s -> buildWeakPredictor(df, weights));

        if (oobCompute) {
            oobError = totalOobError / totalOobInstances;
        }
    }

    @Override
    public void learn(Frame df, Var weights, String... targetVarNames) {

        List<String> targetVarsList = new VarRange(targetVarNames).parseVarNames(df);
        if (targetVarsList.size() != 1) {
            throw new IllegalArgumentException("Forest classifiers can learn only one target variable");
        }
        this.targetNames = targetVarsList.toArray(new String[targetVarsList.size()]);
        this.dict = new HashMap<>();
        this.dict.put(firstTargetName(), df.var(firstTargetName()).dictionary());

        predictors.clear();

        totalOobInstances = 0;
        totalOobError = 0;

        for (int i = 0; i < runs; i++) {
            buildWeakPredictor(df, weights);
        }

        if (oobCompute) {
            oobError = totalOobError / totalOobInstances;
        }
    }

Replace Loop With Pipeline for(int i=0; i < runs; i++) with IntStream.range(0,runs).parallel().forEach(s -> buildWeakPredictor(df,weights)); in method public learn(df Frame, weights Var, targetVarNames String...) : void from class rapaio.ml.classifier.tree.CForest


    public static Comparator<Integer> nominalComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;

        return (row1, row2) -> {
            if (vector.isMissing(row1) && vector.isMissing(row2)) {
                return 0;
            }
            if (vector.isMissing(row1)) {
                return -sign;
            }
            if (vector.isMissing(row2)) {
                return sign;
            }
            return sign * vector.getLabel(row1).compareTo(vector.getLabel(row2));
        };
    }

    public static Comparator<Integer> nominalComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;

        return new Comparator<Integer>() {
            @Override
            public int compare(Integer row1, Integer row2) {
                if (vector.isMissing(row1) && vector.isMissing(row2)) {
                    return 0;
                }
                if (vector.isMissing(row1)) {
                    return -sign;
                }
                if (vector.isMissing(row2)) {
                    return sign;
                }
                return sign * vector.getLabel(row1).compareTo(vector.getLabel(row2));
            }
        };
    }

Replace Anonymous With Lambda rapaio.data.RowComparators.nominalComparator.new Comparator<Integer> with (row1, row2) -> {if(vector.isMissing(row1) && vector.isMissing(row2)){return 0; in method public nominalComparator(vector Vector, asc boolean) : Comparator<Integer> from class rapaio.data.RowComparators


    public static Comparator<Integer> numericComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;
        return (row1, row2) -> {
            if (vector.isMissing(row1) && vector.isMissing(row2)) {
                return 0;
            }
            if (vector.isMissing(row1)) {
                return -sign;
            }
            if (vector.isMissing(row2)) {
                return sign;
            }
            if (vector.getValue(row1) == vector.getValue(row2)) {
                return 0;
            }
            return sign * (vector.getValue(row1) < vector.getValue(row2) ? -1 : 1);
        };
    }

    public static Comparator<Integer> numericComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;
        return new Comparator<Integer>() {
            @Override
            public int compare(Integer row1, Integer row2) {
                if (vector.isMissing(row1) && vector.isMissing(row2)) {
                    return 0;
                }
                if (vector.isMissing(row1)) {
                    return -sign;
                }
                if (vector.isMissing(row2)) {
                    return sign;
                }
                if (vector.getValue(row1) == vector.getValue(row2)) {
                    return 0;
                }
                return sign * (vector.getValue(row1) < vector.getValue(row2) ? -1 : 1);
            }
        };
    }

Replace Anonymous With Lambda rapaio.data.RowComparators.numericComparator.new Comparator<Integer> with (row1, row2) -> {if(vector.isMissing(row1) && vector.isMissing(row2)){return 0; in method public numericComparator(vector Vector, asc boolean) : Comparator<Integer> from class rapaio.data.RowComparators


    public static Comparator<Integer> indexComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;

        return (row1, row2) -> {
            if (vector.isMissing(row1) && vector.isMissing(row2)) {
                return 0;
            }
            if (vector.isMissing(row1)) {
                return -1 * sign;
            }
            if (vector.isMissing(row2)) {
                return sign;
            }
            if (vector.getIndex(row1) == vector.getIndex(row2)) {
                return 0;
            }
            return sign * (vector.getIndex(row1) < vector.getIndex(row2) ? -1 : 1);
        };
    }

    public static Comparator<Integer> indexComparator(final Vector vector, final boolean asc) {
        final int sign = asc ? 1 : -1;

        return new Comparator<Integer>() {
            @Override
            public int compare(Integer row1, Integer row2) {
                if (vector.isMissing(row1) && vector.isMissing(row2)) {
                    return 0;
                }
                if (vector.isMissing(row1)) {
                    return -1 * sign;
                }
                if (vector.isMissing(row2)) {
                    return sign;
                }
                if (vector.getIndex(row1) == vector.getIndex(row2)) {
                    return 0;
                }
                return sign * (vector.getIndex(row1) < vector.getIndex(row2) ? -1 : 1);
            }
        };
    }

Replace Anonymous With Lambda rapaio.data.RowComparators.indexComparator.new Comparator<Integer> with (row1, row2) -> {if(vector.isMissing(row1) && vector.isMissing(row2)){return 0; in method public indexComparator(vector Vector, asc boolean) : Comparator<Integer> from class rapaio.data.RowComparators


    /**
     * Consolidates all the common nominal columns from all frames given as parameter.
     *
     * @param source list of source frames
     * @return list of frames with common nominal columns consolidated
     */
    public static List<Frame> consolidate(List<Frame> source) {

        // learn reunion of labels for all columns
        HashMap<String, HashSet<String>> dicts = new HashMap<>();
        for (int i = 0; i < source.size(); i++) {
            for (Frame frame : source) {
                for (String colName : frame.colNames()) {
                    if (!frame.col(colName).type().isNominal()) {
                        continue;
                    }
                    if (!dicts.containsKey(colName)) {
                        dicts.put(colName, new HashSet<>());
                    }
                    dicts.get(colName).addAll(Arrays.asList(frame.col(colName).getDictionary()));
                }
            }
        }

        // rebuild each frame according with the new consolidated data
        List<Frame> dest = new ArrayList<>();
        for (Frame frame : source) {
            Vector[] vectors = new Vector[frame.colCount()];
            for (int i = 0; i < frame.colCount(); i++) {
                Vector v = frame.col(i);
                String colName = frame.colNames()[i];
                if (!v.type().isNominal()) {
                    vectors[i] = v;
                } else {
                    vectors[i] = new Nominal(v.rowCount(), dicts.get(colName));
                    for (int k = 0; k < vectors[i].rowCount(); k++) {
                        vectors[i].setLabel(k, v.getLabel(k));
                    }
                }
            }
            dest.add(new SolidFrame(frame.rowCount(), vectors, frame.colNames()));
        }

        return dest;
    }

    /**
     * Consolidates all the common nominal columns from all frames given as parameter.
     *
     * @param source list of source frames
     * @return list of frames with common nominal columns consolidated
     */
    public static List<Frame> consolidate(List<Frame> source) {

        // learn reunion of labels for all columns
        HashMap<String, HashSet<String>> dicts = new HashMap<>();
        for (int i = 0; i < source.size(); i++) {
            for (Frame frame : source) {
                for (String colName : frame.colNames()) {
                    if (!frame.col(colName).type().isNominal()) {
                        continue;
                    }
                    if (!dicts.containsKey(colName)) {
                        dicts.put(colName, new HashSet<String>());
                    }
                    dicts.get(colName).addAll(Arrays.asList(frame.col(colName).getDictionary()));
                }
            }
        }

        // rebuild each frame according with the new consolidated data
        List<Frame> dest = new ArrayList<>();
        for (Frame frame : source) {
            Vector[] vectors = new Vector[frame.colCount()];
            for (int i = 0; i < frame.colCount(); i++) {
                Vector v = frame.col(i);
                String colName = frame.colNames()[i];
                if (!v.type().isNominal()) {
                    vectors[i] = v;
                } else {
                    vectors[i] = new Nominal(v.rowCount(), dicts.get(colName));
                    for (int k = 0; k < vectors[i].rowCount(); k++) {
                        vectors[i].setLabel(k, v.getLabel(k));
                    }
                }
            }
            dest.add(new SolidFrame(frame.rowCount(), vectors, frame.colNames()));
        }

        return dest;
    }

Replace Generic With Diamond HashSet<String> with HashSet<> in method public consolidate(source List<Frame>) : List<Frame> from class rapaio.data.filters.BaseFilters


    public void collect(String key) {
        if (!map.containsKey(key)) {
            map.put(key, new ArrayList<>());
        }
        map.get(key).add(current);
    }

    public void collect(String key) {
        if (!map.containsKey(key)) {
            map.put(key, new ArrayList<FSpot>());
        }
        map.get(key).add(current);
    }

Replace Generic With Diamond ArrayList<FSpot> with ArrayList<> in method public collect(key String) : void from class rapaio.data.stream.FIterator


    public BarChart(Vector category, Vector condition, Vector numeric) {
        if (!category.type().isNominal()) {
            throw new IllegalArgumentException("categories are nominal only");
        }
        if (condition == null) {
            condition = new Nominal(category.rowCount(), new HashSet<>());
        }
        if (!condition.type().isNominal()) {
            throw new IllegalArgumentException("conditions are nominal only");
        }
        if (numeric == null) {
            numeric = Vectors.newNum(category.rowCount(), 1);
        }
        if (!numeric.type().isNumeric()) {
            throw new IllegalArgumentException("Numeric vector must be .. isNumeric");
        }

        this.category = category;
        this.condition = condition;
        this.numeric = numeric;

        setLeftThicker(true);
        setLeftMarkers(true);
        setBottomThicker(true);
        setBottomMarkers(true);

        int shift = 9;
        setCol(Vectors.newSeq(shift, condition.getDictionary().length + shift - 1, 1));
    }

    public BarChart(Vector category, Vector condition, Vector numeric) {
        if (!category.type().isNominal()) {
            throw new IllegalArgumentException("categories are nominal only");
        }
        if (condition == null) {
            condition = new Nominal(category.rowCount(), new HashSet<String>());
        }
        if (!condition.type().isNominal()) {
            throw new IllegalArgumentException("conditions are nominal only");
        }
        if (numeric == null) {
            numeric = Vectors.newNum(category.rowCount(), 1);
        }
        if (!numeric.type().isNumeric()) {
            throw new IllegalArgumentException("Numeric vector must be .. isNumeric");
        }

        this.category = category;
        this.condition = condition;
        this.numeric = numeric;

        setLeftThicker(true);
        setLeftMarkers(true);
        setBottomThicker(true);
        setBottomMarkers(true);

        int shift = 9;
        setCol(Vectors.newSeq(shift, condition.getDictionary().length + shift - 1, 1));
    }

Replace Generic With Diamond Nominal with Nominal in method public BarChart(category Vector, condition Vector, numeric Vector) from class rapaio.graphics.BarChart


            @Override
            protected void done() {

                SwingUtilities.invokeLater(() -> {
                    try {
                        currentImage = get();
                        drawWorker = null;
                        revalidate();
                        repaint();
                    } catch (InterruptedException | ExecutionException ex) {
                        JOptionPane.showMessageDialog(null, ex.getMessage());
                    }
                });

            }

            @Override
            protected void done() {

                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            currentImage = get();
                            drawWorker = null;
                            revalidate();
                            repaint();
                        } catch (InterruptedException | ExecutionException ex) {
                            JOptionPane.showMessageDialog(null, ex.getMessage());
                        }
                    }
                });

            }

Replace Anonymous With Lambda rapaio.printer.FigurePanel.createBackgroundImage.new SwingWorker<BufferedImage,Object>.done.invokeLater.new Runnable with () -> {trycurrentImage=get(); in method protected done() : void from class rapaio.printer.FigurePanel.createBackgroundImage.new SwingWorker<BufferedImage,Object>


    public <T> void put(Class<T> clazz, String name, T value) {
        if (!map.containsKey(clazz)) {
            map.put(clazz, new HashMap<>());
        }
        map.get(clazz).put(name, value);
    }

    public <T> void put(Class<T> clazz, String name, T value) {
        if (!map.containsKey(clazz)) {
            map.put(clazz, new HashMap<String, Object>());
        }
        map.get(clazz).put(name, value);
    }

Replace Generic With Diamond HashMap<String,Object> with HashMap<> in method public put(clazz Class<T>, name String, value T) : void from class rapaio.workspace.WorkspaceData


    public NumericTextFormatter(int minDecimals, int maxDecimals) {
        super(
                new StringConverter<>() {
                    @Override
                    public String toString(Number object) {
                        if (object == null) {
                            return "";
                        }
                        String format;
                        if (maxDecimals > 0) {
                            format = "0.";
                        } else {
                            format = "0";
                        }
                        for (int i = 0; i < maxDecimals; i++) {
                            if (i < minDecimals) {
                                format = format + "0";
                            } else {
                                format = format + "#";
                            }
                        }
                        format = format + ";-" + format;
                        DecimalFormat df = new DecimalFormat(format);
                        String formatted = df.format(object);
                        return formatted;
                    }

                    @Override
                    public Number fromString(String string) {
                        try {
                            return format.parse(string);
                        } catch (ParseException e) {
                            return null;
                        }
                    }
                },
                0,
                change -> {
                    if (change.getControlNewText().isEmpty()) {
                        return change;
                    }

                    ParsePosition parsePosition = new ParsePosition(0);
                    Object object = format.parse(change.getControlNewText(), parsePosition);

                    if (change.getControlNewText().equals("-")) {
                        return change;
                    }

                    if (change.getCaretPosition() == 1) {
                        if (change.getControlNewText().equals(".")) {
                            return change;
                        }
                    }

                    if (object == null || parsePosition.getIndex() < change.getControlNewText().length()) {
                        return null;
                    } else {
                        int decPos = change.getControlNewText().indexOf(".");
                        if (decPos > 0) {
                            int numberOfDecimals = change.getControlNewText().substring(decPos + 1).length();
                            if (numberOfDecimals > maxDecimals) {
                                return null;
                            }
                        }
                        return change;
                    }
                }
        );
    }

    public NumericTextFormatter(int minDecimals, int maxDecimals) {
        super(
                new StringConverter<Number>() {
                    @Override
                    public String toString(Number object) {
                        if (object == null) {
                            return "";
                        }
                        String format;
                        if (maxDecimals > 0) {
                            format = "0.";
                        } else {
                            format = "0";
                        }
                        for (int i = 0; i < maxDecimals; i++) {
                            if (i < minDecimals) {
                                format = format + "0";
                            } else {
                                format = format + "#";
                            }
                        }
                        format = format + ";-" + format;
                        DecimalFormat df = new DecimalFormat(format);
                        String formatted = df.format(object);
                        return formatted;
                    }

                    @Override
                    public Number fromString(String string) {
                        try {
                            return format.parse(string);
                        } catch (ParseException e) {
                            return null;
                        }
                    }
                },
                0,
                change -> {
                    if (change.getControlNewText().isEmpty()) {
                        return change;
                    }

                    ParsePosition parsePosition = new ParsePosition(0);
                    Object object = format.parse(change.getControlNewText(), parsePosition);

                    if (change.getControlNewText().equals("-")) {
                        return change;
                    }

                    if (change.getCaretPosition() == 1) {
                        if (change.getControlNewText().equals(".")) {
                            return change;
                        }
                    }

                    if (object == null || parsePosition.getIndex() < change.getControlNewText().length()) {
                        return null;
                    } else {
                        int decPos = change.getControlNewText().indexOf(".");
                        if (decPos > 0) {
                            int numberOfDecimals = change.getControlNewText().substring(decPos + 1).length();
                            if (numberOfDecimals > maxDecimals) {
                                return null;
                            }
                        }
                        return change;
                    }
                }
        );
    }

Replace Generic With Diamond StringConverter<Number> with StringConverter<> in method public NumericTextFormatter(minDecimals int, maxDecimals int) from class comp1206.sushi.server.components.NumericTextFormatter


    public Dish(String name, String description, Number price, Number restockThreshold, Number restockAmount) {
        this.name = new SimpleStringProperty(name);
        this.description = new SimpleStringProperty(description);
        this.price = new SimpleFloatProperty(price.floatValue());
        this.restockThreshold = new SimpleIntegerProperty(restockThreshold.intValue());
        this.restockAmount = new SimpleIntegerProperty(restockAmount.intValue());
        this.recipe = new HashMap<>();
    }

	public Dish(String name, String description, Number price, Number restockThreshold, Number restockAmount) {
		this.name = new SimpleStringProperty(name);
		this.description = new SimpleStringProperty(description);
		this.price = new SimpleFloatProperty(price.floatValue());
		this.restockThreshold = new SimpleIntegerProperty(restockThreshold.intValue());
		this.restockAmount = new SimpleIntegerProperty(restockAmount.intValue());
		this.recipe = new HashMap<Ingredient,Number>();
	}

Replace Generic With Diamond HashMap<Ingredient,Number> with HashMap<> in method public Dish(name String, description String, price Number, restockThreshold Number, restockAmount Number) from class comp1206.sushi.common.Dish


	public Comparator<Frame> refOrderedBatch() {
		return (i, j) -> {
			final boolean less = j.ref().laterThan(i.ref());
			return (less) ? -1 : 1;
		};
	}

	public Comparator<Frame> refOrderedBatch() {
		return new Comparator<Frame>() {
			@Override
			public int compare(Frame i, Frame j) {
//				final boolean less = j.ref().laterThan(i.ref());
				final boolean less = j.ref().laterThan(i.ref());
//				return j.compare(i);
				return (less) ? -1 : 1;
			}
		};
	}

Replace Anonymous With Lambda ron.rdt.Rga.refOrderedBatch.new Comparator<Frame> with (i, j) -> {final boolean less=j.ref().laterThan(i.ref()); in method public refOrderedBatch() : Comparator<Frame> from class ron.rdt.Rga


	public Comparator<UUID> revOrderedUUIDSlice() {
		return (i, j) -> {
			final boolean less = i.laterThan(j);
			return (less) ? 1 : -1;
		};
	}

	public Comparator<UUID> revOrderedUUIDSlice() {
		return new Comparator<UUID>() {
			@Override
			public int compare(UUID i, UUID j) {
				final boolean less = i.laterThan(j);
				return (less) ? 1 : -1;
//				return (less) ? -1 : 1;
			}
		};
	}

Replace Anonymous With Lambda ron.rdt.Rga.revOrderedUUIDSlice.new Comparator<UUID> with (i, j) -> {final boolean less=i.laterThan(j); in method public revOrderedUUIDSlice() : Comparator<UUID> from class ron.rdt.Rga


    @Override
    public void handleEvent(LeaderCardActionEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has activated/discarded a leader card");
        });
    }

    @Override
    public void handleEvent(LeaderCardActionEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has activated/discarded a leader card");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event LeaderCardActionEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(BoughtCardEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has bought a card");
        });
    }

    @Override
    public void handleEvent(BoughtCardEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has bought a card");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event BoughtCardEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(ActivatedProductionEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has used his production");
        });
    }

    @Override
    public void handleEvent(ActivatedProductionEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has used his production");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event ActivatedProductionEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(IncrementPositionEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage(event.getPlayerNickname()+ " has proceeded in the faith track");
        });
    }

    @Override
    public void handleEvent(IncrementPositionEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage(event.getPlayerNickname()+ " has proceeded in the faith track");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event IncrementPositionEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(VaticanReportEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage("A vatican report has been activated");
        });
    }

    @Override
    public void handleEvent(VaticanReportEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage("A vatican report has been activated");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event VaticanReportEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(UseMarketEventS2C event) {
        Platform.runLater(() -> {
            guiView.getSceneController("gameScene").updateScene();
            guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has used the market");
        });
    }

    @Override
    public void handleEvent(UseMarketEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getSceneController("gameScene").updateScene();
                guiView.getCurrentSceneController().showMessage(clientModel.getCurrentPlayerNick() + " has used the market");
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.getSceneController("gameScene").updateScene(); in method public handleEvent(event UseMarketEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(NewTurnEventS2C event) {
        Platform.runLater(() -> {
            if(clientModel.isPregame()){
                guiView.getCurrentSceneController().updateScene();
            }
            if(clientModel.hasGameStarted()){
                guiView.getSceneController("gameScene").updateScene();
                if(clientModel.isCurrentPlayer()){
                    guiView.getCurrentSceneController().showMessage("E' il tuo turno! ");
                }else{
                    guiView.getCurrentSceneController().showMessage("E' il turno di: "+ clientModel.getCurrentPlayerNick());
                }
            }
        });
    }

    @Override
    public void handleEvent(NewTurnEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                if(clientModel.isPregame()){
                    guiView.getCurrentSceneController().updateScene();
                }
                if(clientModel.hasGameStarted()){
                    guiView.getSceneController("gameScene").updateScene();
                    if(clientModel.isCurrentPlayer()){
                        guiView.getCurrentSceneController().showMessage("E' il tuo turno! ");
                    }else{
                        guiView.getCurrentSceneController().showMessage("E' il turno di: "+ clientModel.getCurrentPlayerNick());
                    }
                }
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {if(clientModel.isPregame()){guiView.getCurrentSceneController().updateScene(); in method public handleEvent(event NewTurnEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(IllegalActionEventS2C event) {
        Platform.runLater(() -> guiView.getCurrentSceneController().showMessage("Illegal action: "+event.getIllegalAction().getDescription()));
    }

    @Override
    public void handleEvent(IllegalActionEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.getCurrentSceneController().showMessage("Illegal action: "+event.getIllegalAction().getDescription());
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> guiView.getCurrentSceneController().showMessage("Illegal action: " + event.getIllegalAction().getDescription()) in method public handleEvent(event IllegalActionEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(GameStarterEventS2C event) {

        Platform.runLater(() -> guiView.setCurrentScene("pregameScene"));

    }

    @Override
    public void handleEvent(GameStarterEventS2C event) {

        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.setCurrentScene("pregameScene");
            }
        });

    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> guiView.setCurrentScene("pregameScene") in method public handleEvent(event GameStarterEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    @Override
    public void handleEvent(EndPreparationEventS2C event) {
        Platform.runLater(() -> {
            guiView.setCurrentScene("gameScene");
            guiView.getCurrentSceneController().updateScene();
            if(clientModel.isCurrentPlayer()){
                guiView.getCurrentSceneController().showMessage("E' il tuo turno! ");
            }else{
                guiView.getCurrentSceneController().showMessage("E' il turno di: "+ clientModel.getCurrentPlayerNick());
            }
        });
    }

    @Override
    public void handleEvent(EndPreparationEventS2C event) {
        Platform.runLater(new Runnable() {
            @Override
            public void run() {
                guiView.setCurrentScene("gameScene");
                guiView.getCurrentSceneController().updateScene();
                if(clientModel.isCurrentPlayer()){
                    guiView.getCurrentSceneController().showMessage("E' il tuo turno! ");
                }else{
                    guiView.getCurrentSceneController().showMessage("E' il turno di: "+ clientModel.getCurrentPlayerNick());
                }
            }
        });
    }

Replace Anonymous With Lambda it.polimi.ingsw.client.GUI.EventsHandlerGUI.handleEvent.runLater.new Runnable with () -> {guiView.setCurrentScene("gameScene"); in method public handleEvent(event EndPreparationEventS2C) : void from class it.polimi.ingsw.client.GUI.EventsHandlerGUI


    public void startPing(){
        (new Thread(() -> {
            while(isConnected){
                try {
                    Thread.sleep(5000);
                    send(new PingEventS2C());
                    logger.info("ping inviato");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        })).start();
    }

    public void startPing(){
        Thread pingThread = new Thread(new Runnable() {
            @Override
            public void run(){
                while(isConnected){
                    try {
                        Thread.sleep(5000);
                        send(new PingEventS2C());
                        //System.out.println("ping inviato");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        pingThread.start();
    }

Replace Anonymous With Lambda it.polimi.ingsw.controller.ClientHandler.startPing.pingThread.new Thread.new Runnable with () -> {while(isConnected){tryThread.sleep(5000); in method public startPing() : void from class it.polimi.ingsw.controller.ClientHandler


    @Override
    protected void configure() {
//        String date = String.format("%s{date:HH:mm:ss}%s", Ansi.Green, Ansi.Reset);
        String level = String.format("%s{level}%s", Ansi.BLUE, Ansi.RESET);
        String line = String.format("%s{line}%s", Ansi.YELLOW, Ansi.RESET);
        String clazz = String.format("%s{class}%s", Ansi.WHITE, Ansi.RESET);
        String method = String.format("%s{method}()%s", Ansi.CYAN, Ansi.RESET);
        Logger.getConfiguration()
                .formatPattern(String.format("[%s] %s:%s:%s {message}", level, clazz, line, method))
                .level(Level.INFO).activate();

        bindInterceptor(inSubpackage("net.avdw.todo")
                        .and(not(inSubpackage("net.avdw.todo.model"))),
                new AbstractMatcher<Method>() {
                    @Override
                    public boolean matches(final Method method) {
                        return !method.isSynthetic();
                    }
                },
                (methodInvocation) -> {
                    Parameter[] parameters = methodInvocation.getMethod().getParameters();
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < parameters.length; i++) {
                        stringBuilder.append(parameters[i].getName());
                        stringBuilder.append("=");
                        stringBuilder.append(methodInvocation.getArguments()[i]);
                        if (i != parameters.length - 1) {
                            stringBuilder.append(", ");
                        }
                    }
                    Logger.trace(String.format("%s.%s(%s)",
                            methodInvocation.getMethod().getDeclaringClass().getSimpleName(),
                            methodInvocation.getMethod().getName(),
                            stringBuilder.toString()
                    ));
                    return methodInvocation.proceed();
                });
    }

    @Override
    protected void configure() {
//        String date = String.format("%s{date:HH:mm:ss}%s", Ansi.Green, Ansi.Reset);
        String level = String.format("%s{level}%s", Ansi.Blue, Ansi.Reset);
        String line = String.format("%s{line}%s", Ansi.Yellow, Ansi.Reset);
        String clazz = String.format("%s{class}%s", Ansi.White, Ansi.Reset);
        String method = String.format("%s{method}()%s", Ansi.Cyan, Ansi.Reset);
        Logger.getConfiguration()
                .formatPattern(String.format("[%s] %s:%s:%s {message}", level, clazz, line, method))
                .level(Level.INFO).activate();

        bindInterceptor(inSubpackage("net.avdw.todo")
                        .and(not(inSubpackage("net.avdw.todo.model"))),
                new AbstractMatcher<Method>() {
                    @Override
                    public boolean matches(Method method) {
                        return !method.isSynthetic();
                    }
                },
                (methodInvocation) -> {
                    Parameter[] parameters = methodInvocation.getMethod().getParameters();
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int i = 0; i < parameters.length; i++) {
                        stringBuilder.append(parameters[i].getName());
                        stringBuilder.append("=");
                        stringBuilder.append(methodInvocation.getArguments()[i]);
                        if (i != parameters.length - 1) {
                            stringBuilder.append(", ");
                        }
                    }
                    Logger.trace(String.format("%s.%s(%s)",
                            methodInvocation.getMethod().getDeclaringClass().getSimpleName(),
                            methodInvocation.getMethod().getName(),
                            stringBuilder.toString()
                    ));
                    return methodInvocation.proceed();
                });
    }

Replace Anonymous With Lambda net.avdw.todo.config.LoggingModule.configure.bindInterceptor.new AbstractMatcher<Method> with (methodInvocation) -> {Parameter[] parameters=methodInvocation.getMethod().getParameters(); in method protected configure() : void from class net.avdw.todo.config.LoggingModule


    private static void startDatabaseUpdater() {
        databaseUpdaterIsEnabled = true;
        new Thread(() -> {
            while (true) {
                try {
                    Thread.sleep(5000);
                    updateDatabase();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }

    private static void startDatabaseUpdater() {
        databaseUpdaterIsEnabled = true;
        new Thread(new Runnable() {
            public void run() {
                while (true) {
                    try {
                        Thread.sleep(5000);
                        updateDatabase();
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
    }

Replace Anonymous With Lambda first.user.UserStore.startDatabaseUpdater.start.new Thread.new Runnable with () -> {while(true){tryThread.sleep(5000); in method private startDatabaseUpdater() : void from class first.user.UserStore


    private static void writeLog(String message) {
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(LOG_FILE, true))) {
            writer.write(message);
            writer.newLine();
        } catch (IOException e) {
            System.err.println("Error writing to log file: " + e.getMessage());
        }
    }

    private static void writeLog(String message) {
        BufferedWriter writer = null;
        try {
            writer = new BufferedWriter(new FileWriter(LOG_FILE, true));
            writer.write(message);
            writer.newLine();
        } catch (IOException e) {
            System.err.println("Error writing to log file: " + e.getMessage());
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    System.err.println("Error closing log file: " + e.getMessage());
                }
            }
        }
    }

Try With Resources try(BufferedWriter writer=new BufferedWriter(new FileWriter(LOG_FILE,true))) in method private writeLog(message String) : void from class model.DestinationLog


    @Override
    public void initializeMore() {
        try {
            initializePromotionComboBox();

            sortControl = ViewUtils.loadScreenFromResource(ScreenCode.SORT_CONTROL, mainApp, gameController, sortControlPane);
            sortControlController = (SortControl) sortControl.controller;
            sortControlController.setUpdateAction(e -> {
                updateLabels();
            });

            mainListView.getSelectionModel().selectedItemProperty().addListener((ChangeListener<Object>) (observable, oldValue, newValue) -> {
                if (displaySubScreen != null && newValue != null) {
                    if (displaySubScreen.controller instanceof WorkerOverviewController && currentPromotion != null) {
                        ((WorkerOverviewController) displaySubScreen.controller).setPromotion(currentPromotion);
                    }
                    displaySubScreen.controller.setCurrent(newValue);
                }
            });

            promotionComboBox.setValue(playerPromotion());

            rosterButton.fire();

        } catch (Exception ex) {
            logger.log(Level.ERROR, "Error initializing broswerController", ex);
            throw new RuntimeException(ex);
        }

    }

    @Override
    public void initializeMore() {
        try {
            initializePromotionComboBox();

            sortControl = ViewUtils.loadScreenFromResource(ScreenCode.SORT_CONTROL, mainApp, gameController, sortControlPane);
            sortControlController = (SortControl) sortControl.controller;
            sortControlController.setUpdateAction(e -> {
                updateLabels();
            });

            mainListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Object>() {
                @Override
                public void changed(ObservableValue<? extends Object> observable, Object oldValue, Object newValue) {
                    if (displaySubScreen != null && newValue != null) {
                        if (displaySubScreen.controller instanceof WorkerOverviewController && currentPromotion != null) {
                            ((WorkerOverviewController) displaySubScreen.controller).setPromotion(currentPromotion);
                        }
                        displaySubScreen.controller.setCurrent(newValue);
                    }
                }
            });

            promotionComboBox.setValue(playerPromotion());

            rosterButton.fire();

        } catch (Exception ex) {
            logger.log(Level.ERROR, "Error initializing broswerController", ex);
            throw new RuntimeException(ex);
        }

    }

Replace Anonymous With Lambda openwrestling.view.browser.controller.BrowserController.initializeMore.addListener.new ChangeListener<Object> with (observable, oldValue, newValue) -> {if(displaySubScreen != null && newValue != null){if(displaySubScreen.controller instanceof WorkerOverviewController && currentPromotion != null){((WorkerOverviewController)displaySubScreen.controller).setPromotion(currentPromotion); in method public initializeMore() : void from class openwrestling.view.browser.controller.BrowserController


    @Override
    public void initializeMore() {
        updateTopMatches(ChronoUnit.WEEKS, 1);
        ViewUtils.updateSelectedButton(weekButton, timeButtons);

        GameScreen sortControlScreen = ViewUtils.loadScreenFromResource(ScreenCode.SORT_CONTROL, mainApp, gameController, sortControlPane);
        sortControl = (SortControl) sortControlScreen.controller;
        sortControl.setUpdateAction(e -> {
            updateLabels();
        });
        sortControl.setBrowseMode(BrowseMode.NEWS);
        newsListView.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> {
            if (newValue != null) {
                Text text = new Text(newValue.getSummary());
                text.wrappingWidthProperty().bind(displayPane.widthProperty());
                displayPane.setContent(text);
            }
        });

    }

    @Override
    public void initializeMore() {
        updateTopMatches(ChronoUnit.WEEKS, 1);
        ViewUtils.updateSelectedButton(weekButton, timeButtons);

        sortControl = ViewUtils.loadScreenFromResource(ScreenCode.SORT_CONTROL, mainApp, gameController, sortControlPane);
        sortControlController = (SortControl) sortControl.controller;
        sortControlController.setUpdateAction(e -> {
            updateLabels();
        });
        sortControlController.setFilter(NewsFilter.ALL);
        sortControlController.setNewsMode();
        newsListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<iNewsItem>() {
            @Override
            public void changed(ObservableValue<? extends iNewsItem> observable, iNewsItem oldValue, iNewsItem newValue) {
                if (newValue != null) {
                    Text text = new Text(newValue.getSummary());
                    text.wrappingWidthProperty().bind(displayPane.widthProperty());
                    displayPane.setContent(text);
                }
            }
        });

    }

Replace Anonymous With Lambda openwrestling.view.news.controller.NewsScreenController.initializeMore.addListener.new ChangeListener<iNewsItem> with (observable, oldValue, newValue) -> {if(newValue != null){Text text=new Text(newValue.getSummary()); in method public initializeMore() : void from class openwrestling.view.news.controller.NewsScreenController


    private void initializeAngleTypeComboBox() {
        angleTypeComboBox.setItems(FXCollections.observableArrayList(AngleType.values()));
        angleTypeComboBox.valueProperty().addListener((ov, t, t1) -> {
            if (t1 != null) {
                setAngleType(t1);
            }
        });
        angleTypeComboBox.getSelectionModel().selectFirst();
    }

    private void intitializeAngleTypeComboBox() {
        angleTypeComboBox.setItems(FXCollections.observableArrayList(AngleType.values()));
        angleTypeComboBox.valueProperty().addListener(new ChangeListener<AngleType>() {
            @Override
            public void changed(ObservableValue ov, AngleType t, AngleType t1) {
                if (t1 != null) {
                    setAngleType(t1);
                }
            }
        });
        angleTypeComboBox.getSelectionModel().selectFirst();
    }

Replace Anonymous With Lambda openwrestling.view.event.controller.AngleOptionsController.intitializeAngleTypeComboBox.addListener.new ChangeListener<AngleType> with (ov, t, t1) -> {if(t1 != null){setAngleType(t1); in method private initializeAngleTypeComboBox() : void from class openwrestling.view.event.controller.AngleOptionsController


    private void initializeAngleOptions() {
        angleOptionsScreen = ViewUtils.loadScreenFromFXML(ScreenCode.ANGLE_OPTIONS, mainApp, gameController);
        angleOptionsController = (AngleOptionsController) angleOptionsScreen.controller;

        angleOptionsController.setAngleTypeListener((ov, oldType, newType) -> {
            if (newType != null) {
                titlesWrapper.pane.setVisible(newType.equals(AngleType.CHALLENGE));
                eventScreenController.updateLabels();
            }
        });

        List<Object> challengeOptions = new ArrayList<>();
        challengeOptions.add(ShowType.TONIGHT);
        List<EventTemplate> futureEvents = gameController.getEventManager().getEventTemplates(playerPromotion());
        challengeOptions.addAll(futureEvents);
        angleOptionsController.setChallengeOptions(challengeOptions);

        angleOptionsController.getCombo1().valueProperty().addListener((ObservableValue ov, Object t, Object t1) -> {
            angleOptionChanged(t1);
        });

        angleOptionsController.setChallengeButtonAction(e -> {
            eventScreenController.addSegment(ModelUtils.getSegmentFromTeams(getSegmentTeamsForChallenge()));
        });

        for (int i = 0; i < DEFAULTTEAMS; i++) {

            addTeam(TeamType.DEFAULT);

        }
    }

    private void initializeAngleOptions() {
        angleOptionsScreen = ViewUtils.loadScreenFromFXML(ScreenCode.ANGLE_OPTIONS, mainApp, gameController);
        angleOptionsController = (AngleOptionsController) angleOptionsScreen.controller;

        angleOptionsController.setAngleTypeListener(new ChangeListener<AngleType>() {
            @Override
            public void changed(ObservableValue ov, AngleType oldType, AngleType newType) {
                if (newType != null) {
                    titlesWrapper.pane.setVisible(newType.equals(AngleType.CHALLENGE));
                    eventScreenController.updateLabels();
                }
            }
        });

        List<Object> challengeOptions = new ArrayList<>();
        challengeOptions.add(ShowType.TONIGHT);
        List<EventTemplate> futureEvents = gameController.getEventManager().getEventTemplates(playerPromotion());
        challengeOptions.addAll(futureEvents);
        angleOptionsController.setChallengeOptions(challengeOptions);

        angleOptionsController.getCombo1().valueProperty().addListener((ObservableValue ov, Object t, Object t1) -> {
            angleOptionChanged(t1);
        });

        angleOptionsController.setChallengeButtonAction(e -> {
            eventScreenController.addSegment(ModelUtils.getSegmentFromTeams(getSegmentTeamsForChallenge()));
        });

        for (int i = 0; i < DEFAULTTEAMS; i++) {

            addTeam(TeamType.DEFAULT);

        }
    }

Replace Anonymous With Lambda openwrestling.view.event.controller.SegmentPaneController.initializeAngleOptions.setAngleTypeListener.new ChangeListener<AngleType> with (ov, oldType, newType) -> {if(newType != null){titlesWrapper.pane.setVisible(newType.equals(AngleType.CHALLENGE)); in method private initializeAngleOptions() : void from class openwrestling.view.event.controller.SegmentPaneController


    private void initializeSegmentItemListView() {
        final EventHandler<DragEvent> dragOverHandler = (DragEvent dragEvent) -> {
            LocalDragboard ldb = LocalDragboard.getINSTANCE();

            if (ldb.hasInterface(SegmentItem.class)) {
                dragEvent.acceptTransferModes(TransferMode.MOVE);
            }
        };

        segmentItemListView.setOnDragOver(dragOverHandler);

        //do this last as it is dependent on currentSegment
        updateSegmentItemListView();

        segmentItemListView.setOnDragDropped(new WorkersListViewDragDropHandler(this));

        segmentItemListView.setOnMouseClicked(click -> {
            if (click.getButton() == MouseButton.SECONDARY) {
                currentSegmentPaneController().addTeam(
                        segmentItemListView.getSelectionModel().getSelectedItem().getSegmentItems(), false);
            } else if (click.getButton() == MouseButton.PRIMARY && click.getClickCount() == 2) {
                currentSegmentPaneController().addTeam(
                        segmentItemListView.getSelectionModel().getSelectedItem().getSegmentItems(), 0);
            }
            SegmentItem item = segmentItemListView.getSelectionModel().getSelectedItem();
            if (item instanceof Worker) {
                workerInfoController.setWorker((Worker) item);
            } else {
                workerInfoController.clearText();
            }
            updateLabels();
        });

    }

    private void initializeSegmentItemListView() {
        final EventHandler<DragEvent> dragOverHandler = (DragEvent dragEvent) -> {
            LocalDragboard ldb = LocalDragboard.getINSTANCE();

            if (ldb.hasInterface(SegmentItem.class)) {
                dragEvent.acceptTransferModes(TransferMode.MOVE);
            }
        };

        segmentItemListView.setOnDragOver(dragOverHandler);

        //do this last as it is dependent on currentSegment
        updateSegmentItemListView();

        segmentItemListView.setOnDragDropped(new WorkersListViewDragDropHandler(this));

        segmentItemListView.setOnMouseClicked(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent click) {
                if (click.getButton() == MouseButton.SECONDARY) {
                    currentSegmentPaneController().addTeam(
                            segmentItemListView.getSelectionModel().getSelectedItem().getSegmentItems(), false);
                } else if (click.getButton() == MouseButton.PRIMARY && click.getClickCount() == 2) {
                    currentSegmentPaneController().addTeam(
                            segmentItemListView.getSelectionModel().getSelectedItem().getSegmentItems(), 0);
                }
                updateLabels();
            }
        });

    }

Replace Anonymous With Lambda openwrestling.view.event.controller.EventScreenController.initializeSegmentItemListView.setOnMouseClicked.new EventHandler<MouseEvent> with click -> {if(click.getButton() == MouseButton.SECONDARY){currentSegmentPaneController().addTeam(segmentItemListView.getSelectionModel().getSelectedItem().getSegmentItems(),false); in method private initializeSegmentItemListView() : void from class openwrestling.view.event.controller.EventScreenController


    public void updateTopMatches(ChronoUnit unit, int units) {

        int matchesToShow = 10;

        if (unit.equals(ChronoUnit.WEEKS) && units == 1
                && gameController.getDateManager().today().getDayOfWeek().equals(DayOfWeek.MONDAY)) {
            units++;
        }

        List<Segment> topMatches
                = gameController.getSegmentManager().getTopMatches(
                gameController.getDateManager().today(),
                unit,
                units,
                matchesToShow);

        ObservableList<Segment> items = FXCollections.observableArrayList(topMatches);

        rankingsListView.setItems(items);

        rankingsListView.setCellFactory(param -> new ListCell<>() {
            @Override
            protected void updateItem(Segment segment, boolean empty) {
                super.updateItem(segment, empty);

                if (empty || segment == null) {
                    setGraphic(null);
                } else {
                    Text text = new Text(gameController.getSegmentManager().getIsolatedSegmentString(segment, segment.getEvent()));
                    text.wrappingWidthProperty().bind(rankingsListView.widthProperty());
                    text.setTextAlignment(TextAlignment.CENTER);
                    setGraphic(text);
                }
            }
        });
    }

    public void updateTopMatches(ChronoUnit unit, int units) {

        int matchesToShow = 10;

        if (unit.equals(ChronoUnit.WEEKS) && units == 1
                && gameController.getDateManager().today().getDayOfWeek().equals(DayOfWeek.MONDAY)) {
            units++;
        }

        List<Segment> topMatches
                = gameController.getSegmentManager().getTopMatches(
                gameController.getDateManager().today(),
                unit,
                units,
                matchesToShow);

        ObservableList<Segment> items = FXCollections.observableArrayList(topMatches);

        rankingsListView.setItems(items);

        rankingsListView.setCellFactory(param -> new ListCell<Segment>() {
            @Override
            protected void updateItem(Segment segment, boolean empty) {
                super.updateItem(segment, empty);

                if (empty || segment == null) {
                    setGraphic(null);
                } else {
                    Event event = gameController.getEventManager().refreshEvent(segment.getEvent());
                    Text text = new Text(gameController.getSegmentManager().getIsolatedSegmentString(segment, event));
                    text.wrappingWidthProperty().bind(rankingsListView.widthProperty());
                    text.setTextAlignment(TextAlignment.CENTER);
                    setGraphic(text);
                }
            }
        });
    }

Replace Generic With Diamond ListCell<Segment> with ListCell<> in method public updateTopMatches(unit ChronoUnit, units int) : void from class openwrestling.view.news.controller.NewsScreenController


    private String readFile() {
        byte[] encoded;

        try (InputStream in = getClass().getResourceAsStream("/static_data.sql")) {
            encoded = in.readAllBytes();
        } catch (IOException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }

        return new String(encoded, java.nio.charset.StandardCharsets.UTF_8);
    }

    private String readFile() {
        URL res = getClass().getClassLoader().getResource("static_data.sql");

        byte[] encoded;

        try {
            assert res != null;
            encoded = Files.readAllBytes(Paths.get(res.toURI()));
        } catch (IOException | URISyntaxException e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
        return new String(encoded, java.nio.charset.StandardCharsets.UTF_8);
    }

Try With Resources try(InputStream in=getClass().getResourceAsStream("/static_data.sql")) in method private readFile() : String from class openwrestling.database.StaticDataHelper


    private Task<Void> nextDayTask(NewsScreenController nextDayScreenController, RootLayoutController root) {

        Task<Void> task = new Task<>() {

            @Override
            public Void call() {

                gameController.nextDay();

                try {
                    saveGame();
                } catch (IOException ex) {
                    logger.log(Level.ERROR, "Problem saving Game", ex);
                }
                return null;
            }
        };

        task.setOnSucceeded((WorkerStateEvent t) -> {
            logger.log(Level.DEBUG, "onSucceeded");
            root.setButtonsDisable(false);
            nextDayScreenController.nextDay();
            updateLabels();
            primaryStage.getScene().setCursor(Cursor.DEFAULT);
        });

        return task;
    }

    private Task<Void> nextDayTask(NewsScreenController nextDayScreenController, RootLayoutController root) {

        Task<Void> task = new Task<Void>() {

            @Override
            public Void call() throws InterruptedException {

                gameController.nextDay();

                try {
                    saveGame();
                } catch (IOException ex) {
                    logger.log(Level.ERROR, "Problem saving Game", ex);

                }
                return null;
            }
        };

        task.setOnSucceeded((WorkerStateEvent t) -> {

            root.setButtonsDisable(false);
            nextDayScreenController.nextDay();
            updateLabels();
            primaryStage.getScene().setCursor(Cursor.DEFAULT);
        });

        return task;
    }

Replace Generic With Diamond Task<Void> with Task<> in method private nextDayTask(nextDayScreenController NewsScreenController, root RootLayoutController) : Task<Void> from class openwrestling.MainApp


    @Override
    public void initializeMore() {
        feedPaneScreen = ViewUtils.loadScreenFromResource(ScreenCode.SIMPLE_DISPLAY, mainApp, gameController, feedAnchor);
        contractScreen = ViewUtils.loadScreenFromResource(ScreenCode.CONTRACT, mainApp, gameController, contractAnchor);
        injury.getStyleClass().add("lowStat");

        managerButtonHoverListener = ViewUtils.buttonHoverListener(managerButton);
        entourageButtonHoverListener = ViewUtils.buttonHoverListener(entourageButton);

        entourageButton.setOnAction(a -> {
            List<Worker> workers = new ArrayList<>(gameController.getWorkerManager().selectRoster(promotion));
            workers.removeAll(gameController.getEntourageManager().getEntourage(worker));
            workers.remove(worker);
            Optional<Worker> result = ViewUtils.selectWorkerDialog(
                    workers,
                    resx.getString("JoinEntourageTitle"),
                    String.format(resx.getString("JoinEntourageText"), worker.getName())
            ).showAndWait();

            result.ifPresent(follower -> {
                gameController.getEntourageManager().addWorkerToEntourage(worker, follower);
                updateLabels();
            });
        });

        entourageListView.setCellFactory(c -> new ListCell<>() {
            @Override
            public void updateItem(Worker follower, boolean empty) {
                super.updateItem(follower, empty);
                if (empty) {
                    setText(null);
                    setGraphic(null);
                } else {
                    GameScreen clientScreen = ViewUtils.loadScreenFromFXML(ScreenCode.GROUP_MEMBER, mainApp, gameController);
                    GroupMemberController controller = (GroupMemberController) clientScreen.controller;
                    controller.setCurrent(follower);
                    setPrefHeight(40);
                    setMaxHeight(40);
                    controller.setEditable(Objects.equals(promotion, playerPromotion()));
                    if (Objects.equals(promotion, playerPromotion())) {

                        controller.getxButton().setOnAction(a -> {
                            String header = resx.getString("removing.worker.from.entourage");
                            String content = String.format("Really remove %s from %s's entourage?", follower.getName(), worker.getName());
                            if (ViewUtils.generateConfirmationDialogue(header, content)) {
                                gameController.getEntourageManager().removeWorkerFromEntourage(worker, follower);
                                updateLabels();
                            }
                        });
                    }

                    setGraphic(clientScreen.pane);
                }
            }
        });

        managedListView.setCellFactory(c -> new ListCell<>() {
            @Override
            public void updateItem(Worker client, boolean empty) {
                super.updateItem(client, empty);
                if (empty) {
                    setText(null);
                    setGraphic(null);
                } else {
                    GameScreen clientScreen = ViewUtils.loadScreenFromFXML(ScreenCode.GROUP_MEMBER, mainApp, gameController);
                    GroupMemberController controller = (GroupMemberController) clientScreen.controller;
                    controller.setCurrent(client);
                    setPrefHeight(40);
                    setMaxHeight(40);

                    if (Objects.equals(promotion, playerPromotion())) {
                        controller.getxButton().setOnAction(a -> {
                            String header = "Removing client from manager";
                            String content = String.format("Really remove %s as a client for %s?", client.getName(), worker.getName());
                            if (ViewUtils.generateConfirmationDialogue(header, content)) {
                                client.setManager(null);
                                updateLabels();
                            }
                        });

                    }

                    setGraphic(clientScreen.pane);
                }
            }
        });

        relationshipButton.setOnAction(e -> {
            ViewUtils.generateRelationshipDialog(worker, gameController.getRelationshipManager().getRelationships(worker)).showAndWait();
        });

    }

    @Override
    public void initializeMore() {
        feedPaneScreen = ViewUtils.loadScreenFromResource(ScreenCode.SIMPLE_DISPLAY, mainApp, gameController, feedAnchor);
        contractScreen = ViewUtils.loadScreenFromResource(ScreenCode.CONTRACT, mainApp, gameController, contractAnchor);
        injury.getStyleClass().add("lowStat");

        managerButtonHoverListener = ViewUtils.buttonHoverListener(managerButton);
        entourageButtonHoverListener = ViewUtils.buttonHoverListener(entourageButton);

        entourageButton.setOnAction(a -> {
            List<Worker> workers = new ArrayList<>(gameController.getWorkerManager().selectRoster(promotion));
            workers.removeAll(worker.getEntourage());
            workers.remove(worker);
            Optional<Worker> result = ViewUtils.selectWorkerDialog(
                    workers,
                    resx.getString("JoinEntourageTitle"),
                    String.format(resx.getString("JoinEntourageText"), worker.getName())
            ).showAndWait();

            result.ifPresent(newMember -> {
                worker.getEntourage().add(newMember);
                updateLabels();
            });
        });

        entourageListView.setCellFactory(c -> new ListCell<Worker>() {
            @Override
            public void updateItem(Worker client, boolean empty) {
                super.updateItem(client, empty);
                if (empty) {
                    setText(null);
                    setGraphic(null);
                } else {
                    GameScreen clientScreen = ViewUtils.loadScreenFromFXML(ScreenCode.GROUP_MEMBER, mainApp, gameController);
                    GroupMemberController cotroller = (GroupMemberController) clientScreen.controller;
                    cotroller.setCurrent(client);
                    setPrefHeight(40);
                    setMaxHeight(40);
                    cotroller.setEditable(Objects.equals(promotion, playerPromotion()));
                    if (Objects.equals(promotion, playerPromotion())) {

                        cotroller.getxButton().setOnAction(a -> {
                            String header = resx.getString("removing.worker.from.entourage");
                            String content = String.format("Really remove %s from %s's entourage?", client.getName(), worker.getName());
                            if (ViewUtils.generateConfirmationDialogue(header, content)) {
                                worker.getEntourage().remove(client);
                                updateLabels();
                            }
                        });
                    }

                    setGraphic(clientScreen.pane);
                }
            }
        });

        managedListView.setCellFactory(c -> new ListCell<Worker>() {
            @Override
            public void updateItem(Worker client, boolean empty) {
                super.updateItem(client, empty);
                if (empty) {
                    setText(null);
                    setGraphic(null);
                } else {
                    GameScreen clientScreen = ViewUtils.loadScreenFromFXML(ScreenCode.GROUP_MEMBER, mainApp, gameController);
                    GroupMemberController cotroller = (GroupMemberController) clientScreen.controller;
                    cotroller.setCurrent(client);
                    setPrefHeight(40);
                    setMaxHeight(40);

                    if (Objects.equals(promotion, playerPromotion())) {
                        cotroller.getxButton().setOnAction(a -> {
                            String header = "Removing client from manager";
                            String content = String.format("Really remove %s as a client for %s?", client.getName(), worker.getName());
                            if (ViewUtils.generateConfirmationDialogue(header, content)) {
                                client.setManager(null);
                                updateLabels();
                            }
                        });

                    }

                    setGraphic(clientScreen.pane);
                }
            }
        });

        relationshipButton.setOnAction(e -> {
            ViewUtils.generateRelationshipDialog(worker, gameController.getRelationshipManager().getRelationships(worker)).showAndWait();
        });

    }

Replace Generic With Diamond ListCell<Worker> with ListCell<> in method public initializeMore() : void from class openwrestling.view.browser.controller.WorkerOverviewController


    private void initializePromotionsListView() {
        promotionListView.getSelectionModel().selectedItemProperty().addListener((ChangeListener<Promotion>) (observable, oldValue, newValue) -> {
            updateWorkersListView(newValue);
            ViewUtils.showImage(String.format(mainApp.getLogosFolder().toString() + "\\" + newValue.getImagePath()),
                    promotionImageBorder,
                    imageView);

        });

        promotionListView.getSelectionModel().selectFirst();
    }

    private void initializePromotionsListView() {
        promotionListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Promotion>() {

            @Override
            public void changed(ObservableValue<? extends Promotion> observable, Promotion oldValue, Promotion newValue) {
                updateWorkersListView(newValue);
                ViewUtils.showImage(String.format(mainApp.getLogosFolder().toString() + "\\" + newValue.getImagePath()),
                        promotionImageBorder,
                        imageView);

            }
        });

        promotionListView.getSelectionModel().selectFirst();
    }

Replace Anonymous With Lambda openwrestling.view.start.controller.StartGameScreenController.initializePromotionsListView.addListener.new ChangeListener<Promotion> with (observable, oldValue, newValue) -> {updateWorkersListView(newValue); in method private initializePromotionsListView() : void from class openwrestling.view.start.controller.StartGameScreenController


    private void preparePaneForSorting() {
        draggingTab = new SimpleObjectProperty<>();
        mainPane.setOnDragDetected((MouseEvent event) -> {
            Dragboard dragboard = mainPane.startDragAndDrop(TransferMode.MOVE);
            ClipboardContent clipboardContent = new ClipboardContent();
            clipboardContent.putString(TAB_DRAG_KEY);
            dragboard.setContent(clipboardContent);
            draggingTab.set(mainPane);
            event.consume();
        });
        mainPane.setOnDragOver((DragEvent event) -> {
            final Dragboard dragboard = event.getDragboard();
            if (dragboard.hasString()
                    && TAB_DRAG_KEY.equals(dragboard.getString())
                    && draggingTab.get() != null) {
                event.acceptTransferModes(TransferMode.MOVE);
                event.consume();
            }
        });
        mainPane.setOnDragDropped((final DragEvent event) -> {
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasString()) {
                Pane parent = (Pane) mainPane.getParent();
                Object source = event.getGestureSource();
                int sourceIndex = parent.getChildren().indexOf(source);

                int targetIndex = parent.getChildren().indexOf(mainPane);

                List<Node> nodes = new ArrayList<>(parent.getChildren());
                if (sourceIndex < targetIndex) {
                    Collections.rotate(
                            nodes.subList(sourceIndex, targetIndex + 1), -1);
                } else {
                    Collections.rotate(
                            nodes.subList(targetIndex, sourceIndex + 1), 1);
                }
                parent.getChildren().clear();
                parent.getChildren().addAll(nodes);
                //tell the segmentPaneControlller that the team priority has changed
                segmentPaneController.swapTeamIndices(sourceIndex, targetIndex);

                success = true;
            }
            event.setDropCompleted(success);
            event.consume();
        });
    }

    private void preparePaneForSorting() {
        draggingTab = new SimpleObjectProperty<>();
        mainPane.setOnDragDetected(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                Dragboard dragboard = mainPane.startDragAndDrop(TransferMode.MOVE);
                ClipboardContent clipboardContent = new ClipboardContent();
                clipboardContent.putString(TAB_DRAG_KEY);
                dragboard.setContent(clipboardContent);
                draggingTab.set(mainPane);
                event.consume();
            }
        });
        mainPane.setOnDragOver(new EventHandler<DragEvent>() {
            @Override
            public void handle(DragEvent event) {
                final Dragboard dragboard = event.getDragboard();
                if (dragboard.hasString()
                        && TAB_DRAG_KEY.equals(dragboard.getString())
                        && draggingTab.get() != null) {
                    event.acceptTransferModes(TransferMode.MOVE);
                    event.consume();
                }
            }
        });
        mainPane.setOnDragDropped(new EventHandler<DragEvent>() {
            @Override
            public void handle(final DragEvent event) {
                Dragboard db = event.getDragboard();
                boolean success = false;
                if (db.hasString()) {
                    Pane parent = (Pane) mainPane.getParent();
                    Object source = event.getGestureSource();
                    int sourceIndex = parent.getChildren().indexOf(source);

                    int targetIndex = parent.getChildren().indexOf(mainPane);

                    List<Node> nodes = new ArrayList<>(parent.getChildren());
                    if (sourceIndex < targetIndex) {
                        Collections.rotate(
                                nodes.subList(sourceIndex, targetIndex + 1), -1);
                    } else {
                        Collections.rotate(
                                nodes.subList(targetIndex, sourceIndex + 1), 1);
                    }
                    parent.getChildren().clear();
                    parent.getChildren().addAll(nodes);
                    //tell the segmentPaneControlller that the team priority has changed
                    segmentPaneController.swapTeamIndices(sourceIndex, targetIndex);

                    success = true;
                }
                event.setDropCompleted(success);
                event.consume();
            }
        });
    }

Replace Anonymous With Lambda wrestling.view.TeamPaneController.preparePaneForSorting.setOnDragDropped.new EventHandler<DragEvent> with (event) -> {Dragboard db=event.getDragboard(); in method private preparePaneForSorting() : void from class wrestling.view.TeamPaneController


    private List<Worker> allWorkers(List<Segment> segments) {

        List allWorkers = new ArrayList<>();
        for (Segment currentSegment : segments) {
            allWorkers.addAll(currentSegment.allWorkers());

        }

        //this should take the list of workers generated above
        //and convert it to a set, removing duplicates
        Set<Worker> allWorkersSet = new LinkedHashSet<>(allWorkers);
        //convert the set back to a list with no duplicates
        allWorkers = new ArrayList<>(allWorkersSet);

        return allWorkers;
    }

    private List<Worker> allWorkers(List<Segment> segments) {

        List allWorkers = new ArrayList<>();
        for (Segment currentSegment : segments) {
            allWorkers.addAll(currentSegment.allWorkers());

        }

        //this should take the list of workers generated above
        //and convert it to a set, removing duplicates
        Set<Worker> allWorkersSet = new LinkedHashSet<>(allWorkers);
        //convert the set back to a list with no duplicates
        allWorkers = new ArrayList<Worker>(allWorkersSet);

        return allWorkers;
    }

Replace Generic With Diamond ArrayList<Worker> with ArrayList<> in method private allWorkers(segments List<Segment>) : List<Worker> from class wrestling.model.factory.EventFactory


    private void initializeMore() {

        //here we set a blank event
        initializeSegmentListView();

        /*
        create versespanes and controllers for each segment and keeps references
        will need to be more flexible when other segment types are possible
         */
        for (int i = 0; i < totalSegments; i++) {
            addSegment();
        }

        segmentListView.getSelectionModel().selectFirst();

        //for the workersListView to accept dragged items
        final EventHandler<DragEvent> dragOverHandler = (DragEvent dragEvent) -> {
            dragEvent.acceptTransferModes(TransferMode.MOVE);
        };

        workersListView.setOnDragOver(dragOverHandler);

        //do this last as it is dependent on currentSegment
        updateWorkerListView();

        //add the special DragDropHandlder
        workersListView.setOnDragDropped(new WorkersListViewDragDropHandler());

    }

    private void initializeMore() {

        //here we set a blank event
        initializeSegmentListView();

        /*
        create versespanes and controllers for each segment and keeps references
        will need to be more flexible when other segment types are possible
         */
        for (int i = 0; i < totalSegments; i++) {
            addSegment();
        }

        segmentListView.getSelectionModel().selectFirst();

        //for the workersListView to accept dragged items
        final EventHandler<DragEvent> dragOverHandler = new EventHandler<DragEvent>() {
            @Override
            public void handle(DragEvent dragEvent) {

                dragEvent.acceptTransferModes(TransferMode.MOVE);

            }
        };

        workersListView.setOnDragOver(dragOverHandler);

        //do this last as it is dependent on currentSegment
        updateWorkerListView();

        //add the special DragDropHandlder
        workersListView.setOnDragDropped(new WorkersListViewDragDropHandler());

    }

Replace Anonymous With Lambda wrestling.view.EventScreenController.initializeMore.dragOverHandler.new EventHandler<DragEvent> with (dragEvent) -> {dragEvent.acceptTransferModes(TransferMode.MOVE); in method private initializeMore() : void from class wrestling.view.EventScreenController


    private void sortByPopularity(List<Worker> workerList) {
        //sort roster by popularity
        Collections.sort(workerList, (Worker w1, Worker w2) -> -Integer.valueOf(w1.getPopularity()).compareTo(w2.getPopularity()));
    }

    private void sortByPopularity(List<Worker> workerList) {
        //sort roster by popularity
        Collections.sort(workerList, new Comparator<Worker>() {
            @Override
            public int compare(Worker w1, Worker w2) {
                return -Integer.valueOf(w1.getPopularity()).compareTo(w2.getPopularity());
            }
        });
    }

Replace Anonymous With Lambda wrestling.model.PromotionAi.sortByPopularity.sort.new Comparator<Worker> with (w1, w2) -> -Integer.valueOf(w1.getPopularity()).compareTo(w2.getPopularity()) in method private sortByPopularity(workerList List<Worker>) : void from class wrestling.model.PromotionAi


    private LocalDragboard() {
        this.contents = new HashMap<>();
    }

    private LocalDragboard() {
        this.contents = new HashMap<Class<?>, Object>();
    }

Replace Generic With Diamond HashMap<Class<?>,Object> with HashMap<> in method private LocalDragboard() from class wrestling.view.LocalDragboard


    private void preparePaneForSorting() {
        draggingTab = new SimpleObjectProperty<>();
        mainPane.setOnDragDetected(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                Dragboard dragboard = mainPane.startDragAndDrop(TransferMode.MOVE);
                ClipboardContent clipboardContent = new ClipboardContent();
                clipboardContent.putString(TAB_DRAG_KEY);
                dragboard.setContent(clipboardContent);
                draggingTab.set(mainPane);
                event.consume();
            }
        });
        mainPane.setOnDragOver(new EventHandler<DragEvent>() {
            @Override
            public void handle(DragEvent event) {
                final Dragboard dragboard = event.getDragboard();
                if (dragboard.hasString()
                        && TAB_DRAG_KEY.equals(dragboard.getString())
                        && draggingTab.get() != null) {
                    event.acceptTransferModes(TransferMode.MOVE);
                    event.consume();
                }
            }
        });
        mainPane.setOnDragDropped(new EventHandler<DragEvent>() {
            public void handle(final DragEvent event) {
                Dragboard db = event.getDragboard();
                boolean success = false;
                if (db.hasString()) {
                    Pane parent = (Pane) mainPane.getParent();
                    Object source = event.getGestureSource();
                    int sourceIndex = parent.getChildren().indexOf(source);

                    int targetIndex = parent.getChildren().indexOf(mainPane);

                    List<Node> nodes = new ArrayList<Node>(parent.getChildren());
                    if (sourceIndex < targetIndex) {
                        Collections.rotate(
                                nodes.subList(sourceIndex, targetIndex + 1), -1);
                    } else {
                        Collections.rotate(
                                nodes.subList(targetIndex, sourceIndex + 1), 1);
                    }
                    parent.getChildren().clear();
                    parent.getChildren().addAll(nodes);
                    //tell the segmentPaneControlller that the team priority has changed
                    segmentPaneController.swapTeamIndices(sourceIndex, targetIndex);

                    success = true;
                }
                event.setDropCompleted(success);
                event.consume();
            }
        });
    }

    private void preparePaneForSorting() {
        draggingTab = new SimpleObjectProperty<AnchorPane>();
        mainPane.setOnDragDetected(new EventHandler<MouseEvent>() {
            @Override
            public void handle(MouseEvent event) {
                Dragboard dragboard = mainPane.startDragAndDrop(TransferMode.MOVE);
                ClipboardContent clipboardContent = new ClipboardContent();
                clipboardContent.putString(TAB_DRAG_KEY);
                dragboard.setContent(clipboardContent);
                draggingTab.set(mainPane);
                event.consume();
            }
        });
        mainPane.setOnDragOver(new EventHandler<DragEvent>() {
            @Override
            public void handle(DragEvent event) {
                final Dragboard dragboard = event.getDragboard();
                if (dragboard.hasString()
                        && TAB_DRAG_KEY.equals(dragboard.getString())
                        && draggingTab.get() != null) {
                    event.acceptTransferModes(TransferMode.MOVE);
                    event.consume();
                }
            }
        });
        mainPane.setOnDragDropped(new EventHandler<DragEvent>() {
            public void handle(final DragEvent event) {
                Dragboard db = event.getDragboard();
                boolean success = false;
                if (db.hasString()) {
                    Pane parent = (Pane) mainPane.getParent();
                    Object source = event.getGestureSource();
                    int sourceIndex = parent.getChildren().indexOf(source);

                    int targetIndex = parent.getChildren().indexOf(mainPane);

                    List<Node> nodes = new ArrayList<Node>(parent.getChildren());
                    if (sourceIndex < targetIndex) {
                        Collections.rotate(
                                nodes.subList(sourceIndex, targetIndex + 1), -1);
                    } else {
                        Collections.rotate(
                                nodes.subList(targetIndex, sourceIndex + 1), 1);
                    }
                    parent.getChildren().clear();
                    parent.getChildren().addAll(nodes);
                    //tell the segmentPaneControlller that the team priority has changed
                    segmentPaneController.swapTeamIndices(sourceIndex, targetIndex);

                    success = true;
                }
                event.setDropCompleted(success);
                event.consume();
            }
        });
    }

Replace Generic With Diamond SimpleObjectProperty<AnchorPane> with SimpleObjectProperty<> in method private preparePaneForSorting() : void from class wrestling.view.TeamPaneController


        public static Callback<SegmentNameItem, Observable[]> extractor() {
            return (SegmentNameItem param) -> new Observable[]{param.segment, param.name};
        }

        public static Callback<SegmentNameItem, Observable[]> extractor() {
            return new Callback<SegmentNameItem, Observable[]>() {
                @Override
                public Observable[] call(SegmentNameItem param) {
                    return new Observable[]{param.segment, param.name};
                }
            };
        }

Replace Anonymous With Lambda wrestling.view.EventScreenController.SegmentNameItem.extractor.new Callback<SegmentNameItem,Observable[]> with (param) -> new Observable[]{param.segment,param.name} in method public extractor() : Callback<SegmentNameItem,Observable[]> from class wrestling.view.EventScreenController.SegmentNameItem


        public SorterCell() {
            ListCell thisCell = this;

            setOnDragDetected((MouseEvent event) -> {
                if (getItem() == null) {

                    return;
                }

                Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
                ClipboardContent content = new ClipboardContent();
                content.putString(getText());
                LocalDragboard.getInstance().putValue(SegmentNameItem.class, getItem());
                content.putString(getItem().name.get());

                dragboard.setContent(content);

                event.consume();
            });

            setOnDragOver(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    event.acceptTransferModes(TransferMode.MOVE);
                }

                event.consume();
            });

            setOnDragEntered(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    setOpacity(0.3);
                }
            });

            setOnDragExited(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    setOpacity(1);
                }
            });

            setOnDragDropped((DragEvent event) -> {
                if (getText() == null) {

                    return;

                }

                boolean success = false;

                LocalDragboard ldb = LocalDragboard.getInstance();
                if (ldb.hasType(SegmentNameItem.class)) {
                    SegmentNameItem segmentNameItem = ldb.getValue(SegmentNameItem.class);
                    ObservableList<SegmentNameItem> items = getListView().getItems();
                    int draggedIdx = items.indexOf(segmentNameItem);
                    int thisIdx = items.indexOf(getItem());

                    //swap all parallel arrays associated with the segment
                    Collections.swap(items, thisIdx, draggedIdx);
                    Collections.swap(segmentPanes, thisIdx, draggedIdx);
                    Collections.swap(segmentPaneControllers, thisIdx, draggedIdx);
                    Collections.swap(segments, thisIdx, draggedIdx);

                    setCurrentSegmentNumber(thisIdx);

                    segmentListView.getSelectionModel().select(segmentNameItem);
                    success = true;
                }

                event.setDropCompleted(success);

                event.consume();
            });

            setOnDragDone(DragEvent::consume);
        }

        public SorterCell() {
            ListCell thisCell = this;

            setOnDragDetected(new EventHandler<MouseEvent>() {
                @Override
                public void handle(MouseEvent event) {
                    if (getItem() == null) {

                        return;
                    }

                    Dragboard dragboard = startDragAndDrop(TransferMode.MOVE);
                    ClipboardContent content = new ClipboardContent();
                    content.putString(getText());
                    LocalDragboard.getInstance().putValue(SegmentNameItem.class, getItem());
                    content.putString(getItem().name.get());

                    dragboard.setContent(content);;

                    event.consume();
                }
            });

            setOnDragOver(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    event.acceptTransferModes(TransferMode.MOVE);
                }

                event.consume();
            });

            setOnDragEntered(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    setOpacity(0.3);
                }
            });

            setOnDragExited(event -> {
                if (event.getGestureSource() != thisCell
                        && event.getDragboard().hasString()) {
                    setOpacity(1);
                }
            });

            setOnDragDropped(new EventHandler<DragEvent>() {
                @Override
                public void handle(DragEvent event) {
                    if (getText() == null) {

                        return;

                    }

                    boolean success = false;

                    LocalDragboard ldb = LocalDragboard.getInstance();
                    if (ldb.hasType(SegmentNameItem.class)) {
                        SegmentNameItem segmentNameItem = ldb.getValue(SegmentNameItem.class);
                        ObservableList<SegmentNameItem> items = getListView().getItems();
                        int draggedIdx = items.indexOf(segmentNameItem);
                        int thisIdx = items.indexOf(getItem());

                        //swap all parallel arrays associated with the segment
                        Collections.swap(items, thisIdx, draggedIdx);
                        Collections.swap(segmentPanes, thisIdx, draggedIdx);
                        Collections.swap(segmentPaneControllers, thisIdx, draggedIdx);
                        Collections.swap(segments, thisIdx, draggedIdx);

                        setCurrentSegmentNumber(thisIdx);

                        segmentListView.getSelectionModel().select(segmentNameItem);
                        success = true;
                    }

                    event.setDropCompleted(success);

                    event.consume();
                }
            });

            setOnDragDone(DragEvent::consume);
        }

Replace Anonymous With Lambda wrestling.view.EventScreenController.SorterCell.SorterCell.setOnDragDetected.new EventHandler<MouseEvent> with (event) -> {if(getItem() == null){return; in method public SorterCell() from class wrestling.view.EventScreenController.SorterCell


    @Override
    public List<Worker> allWorkers() {
        List<Worker> allWorkersList = new ArrayList<>();

        for (List<Worker> team : teams) {
            allWorkersList.addAll(team);
        }

        return allWorkersList;
    }

    @Override
    public List<Worker> allWorkers() {
        List<Worker> allWorkersList = new ArrayList<Worker>();

        for (List<Worker> team : teams) {
            allWorkersList.addAll(team);
        }

        return allWorkersList;
    }

Replace Generic With Diamond ArrayList<Worker> with ArrayList<> in method public allWorkers() : List<Worker> from class wrestling.model.Match


    public void saveGame() throws FileNotFoundException, IOException {

        FileOutputStream fileOutputStream = new FileOutputStream("wrestlingsavegame.ser");
        try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
            objectOutputStream.writeObject(gameController);
        }

    }

    public void saveGame() {
        try {

            FileOutputStream fileOutputStream = new FileOutputStream("wrestlingsavegame.ser");
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream);
            objectOutputStream.writeObject(gameController);
            objectOutputStream.close();

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

    }

Try With Resources try(ObjectOutputStream objectOutputStream=new ObjectOutputStream(fileOutputStream)) in method public saveGame() : void from class wrestling.MainApp


    public void loadGame() throws ClassNotFoundException, FileNotFoundException, IOException {

        FileInputStream fileInputStream = new FileInputStream("wrestlingsavegame.ser");
        try (ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream)) {
            gameController = null;
            gameController = (GameController) objectInputStream.readObject();
        }

        //now we need to update the rootlayoutcontroller with the newly
        //loaded gameController or else it won't have the correct controller
        rootLayoutController.setGameController(gameController);

    }

    public void loadGame() throws ClassNotFoundException {
        try {

            FileInputStream fileInputStream = new FileInputStream("wrestlingsavegame.ser");
            ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
            gameController = null;
            gameController = (GameController) objectInputStream.readObject();

            objectInputStream.close();

            //now we need to update the rootlayoutcontroller with the newly
            //loaded gameController or else it won't have the correct controller
            rootLayoutController.setGameController(gameController);

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

    }

Try With Resources try(ObjectInputStream objectInputStream=new ObjectInputStream(fileInputStream)) in method public loadGame() : void from class wrestling.MainApp