    public static void main(String[] args) throws IOException, InterruptedException {
        Platform platform = Platform.parse(System.getProperty("os.name"));
        Architecture arch = Architecture.parse(System.getProperty("os.arch"));
        System.out.println("Platform: " + platform);
        System.out.println("Architecture: " + arch);
        PlatformResolver platformResolver = PlatformResolver.getPlatformResolver(platform, arch);
        Scanner scanner = new Scanner(System.in);
        if (arch != Architecture.ARM64) {
            System.err.println("Architecture of your computer is not ARM64. If this is want you want, you can ignore this error.");
            System.out.println("But if your computer is ARM64, please make sure you are using ARM64 Java.");
            System.err.println("Please enter 'ENTER' key to continue.");
            scanner.next();
        }
        Options options = Options.parse(args, new OptionParserClassifier("path", OptionType.DEFAULT_OPTION_TYPE));
        Option option = options.get("path");
        String path = System.getProperty("user.dir");
        if (option != null)
            path = option.get(OptionType.DEFAULT_OPTION_TYPE);
        File file = new File(path);
        String filename = file.getName() + ".json";
        File jsonFile = new File(file, filename);
        Set<Pair<String, String>> libs = new HashSet<>();
        if (jsonFile.exists()) {
            System.out.println("Found json file: " + jsonFile.getAbsolutePath());
            JSONObject json = JSON.parse(Files.readString(jsonFile.toPath()));
            JSONList libraries = json.getList("libraries");
            System.out.println("Start collecting libraries needed to download...");
            for (JSONObject library : libraries) {
                String name = library.get("name");
                String[] arguments = name.split(":");
                String group = arguments[0];
                String type = arguments[1];
                String version = arguments[2];
                if (group.equals("org.lwjgl")) {
                    JSONList rules = library.getList("rules");
                    boolean allowed = true;
                    for (JSONObject object : rules) {
                        JSON rule = (JSON) object;
                        if (rule.get("action").equals("disallow"))
                            if (rule.contains("os")) {
                                JSON os = rule.getJSON("os");
                                if (os.get("name").equals(platform.getNativesName()))
                                    allowed = false;
                            }
                    }
                    if (allowed)
                        libs.add(Pair.of(type, version));
                }
            }
            System.out.println("Collect finished. All libraries needed to download: " + libs.size());
            System.out.println("Start downloading...");
            List<Pair<String, String>> builtLibs = new ArrayList<>();
            for (Pair<String, String> lib : libs) {
                String type = lib.getFirst();
                String version = lib.getSecond();
                String url = PREFIX_URL + type + "/" + version + "/" + type + "-" + version + "-" + platform.getDownloadName(arch) + ".jar";
                System.out.println("Download " + url);
                try {
                    InputStream inputStream = new URL(url).openStream();
                } catch (FileNotFoundException e) {
                    builtLibs.add(lib);
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(-1);
                }
            }
            System.out.println("Downloading finished. All libraries downloaded: " + (libs.size() - builtLibs.size()));
            System.out.println("Start building libraries: " + builtLibs.size());
            Set<String> versions = new HashSet<>();
            for (Pair<String, String> lib : builtLibs) {
                String version = lib.getSecond();
                if (versions.contains(version))
                    continue;
                versions.add(version);
                String url = LWJGL_SOURCE_URL + version + ".zip";
                System.out.println("Download built library: " + url);
                if (!new File(file, "lwjgl3-" + version).exists()) {
                    InputStream inputStream = new URL(url).openStream();
                    try(ZipInputStream zipInputStream = new ZipInputStream(inputStream)) {
                        ZipEntry entry;
                        while ((entry = zipInputStream.getNextEntry()) != null) {
                            File newFile = new File(file, entry.getName());
                            if (entry.isDirectory()) {
                                if (!newFile.isDirectory() && !newFile.mkdirs()) {
                                    throw new IOException("Failed to create directory " + newFile);
                                }
                            } else {
                                // fix for Windows-created archives
                                File parent = newFile.getParentFile();
                                if (!parent.isDirectory() && !parent.mkdirs()) {
                                    throw new IOException("Failed to create directory " + parent);
                                }

                                // write file content
                                Files.copy(zipInputStream, newFile.toPath());
                            }
                        }
                        zipInputStream.closeEntry();
                    } catch (Exception e) {
                        e.printStackTrace();
                        System.exit(-1);
                    }
                }
                File lwjgl3 = new File(file, "lwjgl3-" + version);
                System.out.println("Replace necessary files...");
                platformResolver.resolvePrebuild(lwjgl3);
                System.out.println("Download necessary files...");
                platformResolver.resolvePredownload(lwjgl3);
                System.out.println("Build library: " + version);
                Process process = new ProcessBuilder("ant","compile-templates").redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT).directory(lwjgl3).start();
                process.waitFor();
                System.out.println("Finish 25%");
                process = new ProcessBuilder("ant","compile-native").redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT).directory(lwjgl3).start();
                process.waitFor();
                System.out.println("Finish 50%");
            }
        } else {
            System.out.println("Can't find json file: " + jsonFile.getAbsolutePath());
        }
    }

    public static void main(String[] args) throws IOException, InterruptedException {
        Platform platform = Platform.parse(System.getProperty("os.name"));
        Architecture arch = Architecture.parse(System.getProperty("os.arch"));
        System.out.println("Platform: " + platform);
        System.out.println("Architecture: " + arch);
        Scanner scanner = new Scanner(System.in);
        if (arch != Architecture.ARM64) {
            System.err.println("Architecture of your computer is not ARM64. If this is want you want, you can ignore this error.");
            System.out.println("But if your computer is ARM64, please make sure you are using ARM64 Java.");
            System.err.println("Please enter 'ENTER' key to continue.");
            scanner.next();
        }
        Options options = Options.parse(args, new OptionParserClassifier("path", OptionType.DEFAULT_OPTION_TYPE));
        Option option = options.get("path");
        String path = System.getProperty("user.dir");
        if (option != null)
            path = option.get(OptionType.DEFAULT_OPTION_TYPE);
        File file = new File(path);
        String filename = file.getName() + ".json";
        File jsonFile = new File(file, filename);
        Set<Pair<String, String>> libs = new HashSet<>();
        if (jsonFile.exists()) {
            System.out.println("Found json file: " + jsonFile.getAbsolutePath());
            JSONObject json = JSON.parse(Files.readString(jsonFile.toPath()));
            JSONList libraries = json.getList("libraries");
            System.out.println("Start collecting libraries needed to download...");
            for (JSONObject library : libraries) {
                String name = library.get("name");
                String[] arguments = name.split(":");
                String group = arguments[0];
                String type = arguments[1];
                String version = arguments[2];
                if (group.equals("org.lwjgl")) {
                    JSONList rules = library.getList("rules");
                    boolean allowed = true;
                    for (JSONObject object : rules) {
                        JSON rule = (JSON) object;
                        if (rule.get("action").equals("disallow"))
                            if (rule.contains("os")) {
                                JSON os = rule.getJSON("os");
                                if (os.get("name").equals(platform.getNativesName()))
                                    allowed = false;
                            }
                    }
                    if (allowed)
                        libs.add(Pair.of(type, version));
                }
            }
            System.out.println("Collect finished. All libraries needed to download: " + libs.size());
            System.out.println("Start downloading...");
            List<Pair<String, String>> builtLibs = new ArrayList<>();
            for (Pair<String, String> lib : libs) {
                String type = lib.getFirst();
                String version = lib.getSecond();
                String url = PREFIX_URL + type + "/" + version + "/" + type + "-" + version + "-" + platform.getDownloadName(arch) + ".jar";
                System.out.println("Download " + url);
                try {
                    InputStream inputStream = new URL(url).openStream();
                } catch (FileNotFoundException e) {
                    builtLibs.add(lib);
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(-1);
                }
            }
            System.out.println("Downloading finished. All libraries downloaded: " + (libs.size() - builtLibs.size()));
            System.out.println("Start building libraries: " + builtLibs.size());
            Set<String> versions = new HashSet<>();
            for (Pair<String, String> lib : builtLibs) {
                String version = lib.getSecond();
                if (versions.contains(version))
                    continue;
                versions.add(version);
                String url = LWJGL_SOURCE_URL + version + ".zip";
                System.out.println("Download built library: " + url);
                if (!new File(file, "lwjgl3-" + version).exists())
                    try {
                        InputStream inputStream = new URL(url).openStream();
                        ZipInputStream zipInputStream = new ZipInputStream(inputStream);
                        ZipEntry entry;
                        while((entry = zipInputStream.getNextEntry()) != null) {
                            File newFile = new File(file, entry.getName());
                            if (entry.isDirectory()) {
                                if (!newFile.isDirectory() && !newFile.mkdirs()) {
                                    throw new IOException("Failed to create directory " + newFile);
                                }
                            } else {
                                // fix for Windows-created archives
                                File parent = newFile.getParentFile();
                                if (!parent.isDirectory() && !parent.mkdirs()) {
                                    throw new IOException("Failed to create directory " + parent);
                                }

                                // write file content
                                Files.copy(zipInputStream, newFile.toPath());
                            }
                        }
                        zipInputStream.closeEntry();
                        zipInputStream.close();
                    } catch (Exception e) {
                        e.printStackTrace();
                        System.exit(-1);
                    }
                File lwjgl3 = new File(file, "lwjgl3-" + version);
                System.out.println("Replace necessary files...");
                Files.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("config/build-definitions.xml"), new File(lwjgl3, "config/build-definitions.xml").toPath(), StandardCopyOption.REPLACE_EXISTING);
                Files.copy(Thread.currentThread().getContextClassLoader().getResourceAsStream("config/macos/build.xml"), new File(lwjgl3, "config/macos/build.xml").toPath(), StandardCopyOption.REPLACE_EXISTING);
                System.out.println("Download necessary files...");
                System.out.println("Build library: " + version);
                Process process = new ProcessBuilder("ant","compile-templates").redirectOutput(ProcessBuilder.Redirect.INHERIT).redirectError(ProcessBuilder.Redirect.INHERIT).directory(lwjgl3).start();
                process.waitFor();
            }
        } else {
            System.out.println("Can't find json file: " + jsonFile.getAbsolutePath());
        }
    }

Try With Resources try(ZipInputStream zipInputStream=new ZipInputStream(inputStream)) in method public main(args String[]) : void from class top.focess.minecraft.mclwjglnativesdownloader.MCLWJGLNativesDownloader


        @Override
        public List<File> getFilesByName(String query) throws IOException {
            try (Connection conn = factory.createObject(Connection.class)) {
                conn.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");
                try (Recordset rs = conn.Execute("SELECT System.ItemUrl FROM SYSTEMINDEX WHERE SCOPE='file:' AND System.FileName like '%" + escapeQuery(query) + "%'")) {
                    List<File> result = new ArrayList<>();
                    if (!(rs.getBOF() && rs.getEOF())) {
                        rs.MoveFirst();
                        while (!rs.getEOF()) {
                            result.add(toFile(rs.getFields().getItem(0)));
                            rs.MoveNext();
                        }
                    }
                    return result;
                }
            } catch (COMException ex) {
                throw new IOException(ex);
            }
        }

        @Override
        public File[] search(String query) throws IOException {
            List<File> result = new ArrayList<>();
            Connection conn = null;
            Recordset rs = null;
            try {
                conn = factory.createObject(Connection.class);
                conn.Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");
                rs = conn.Execute("SELECT System.ItemUrl FROM SYSTEMINDEX WHERE SCOPE='file:' AND System.FileName like '%" + escapeQuery(query) + "%'");
                if (!(rs.getBOF() && rs.getEOF())) {
                    rs.MoveFirst();
                    while (!rs.getEOF()) {
                        result.add(new File(rs.getFields().getItem(0).getValue().toString().replace("file:", "")));
                        rs.MoveNext();
                    }
                }
            } catch (COMException ex) {
                throw new IOException(ex);
            } finally {
                if (rs != null) {
                    rs.Close();
                }
                if (conn != null) {
                    conn.Close();
                }
            }
            return result.toArray(new File[result.size()]);
        }

Try With Resources try(Recordset rs=conn.Execute("SELECT System.ItemUrl FROM SYSTEMINDEX WHERE SCOPE='file:' AND System.FileName like '%" + escapeQuery(query) + "%'")) in method public getFilesByName(query String) : List<File> from class ec.util.desktop.impl.WinSearch.JnaSearch


        public void registerChartChange(JFreeChart source) {
            ChartChangeListener realListener = event -> refreshActionState();
            putValue("ChartChangeListener", realListener);
            source.addChangeListener(new WeakChartChangeListener(realListener) {
                @Override
                protected void unregister(Object source) {
                    ((JFreeChart) source).removeChangeListener(this);
                }
            });
        }

        public void registerChartChange(JFreeChart source) {
            ChartChangeListener realListener = new ChartChangeListener() {
                @Override
                public void chartChanged(ChartChangeEvent event) {
                    refreshActionState();
                }
            };
            putValue("ChartChangeListener", realListener);
            source.addChangeListener(new WeakChartChangeListener(realListener) {
                @Override
                protected void unregister(Object source) {
                    ((JFreeChart) source).removeChangeListener(this);
                }
            });
        }

Replace Anonymous With Lambda ec.util.chart.swing.ChartCommand.ChartActionAdapter.registerChartChange.realListener.new ChartChangeListener with event -> refreshActionState() in method public registerChartChange(source JFreeChart) : void from class ec.util.chart.swing.ChartCommand.ChartActionAdapter


    private void enableSelection() {
        chartPanel.addMouseListener(new SelectionMouseListener(seriesSelectionModel, true) {
            @Override
            public void mousePressed(MouseEvent e) {
                if (isInteractive()) {
                    super.mousePressed(e);
                }
            }

            @Override
            protected int getSelectionIndex(LegendItemEntity entity) {
                return entity != null ? dataset.indexOf(entity.getSeriesKey()) : -1;
            }
        });
        seriesSelectionModel.addListSelectionListener(e -> {
            if (!e.getValueIsAdjusting()) {
                notification.forceRefresh();
            }
        });
    }

    private void enableSelection() {
        chartPanel.addMouseListener(new SelectionMouseListener(seriesSelectionModel, true) {
            @Override
            public void mousePressed(MouseEvent e) {
                if (isInteractive()) {
                    super.mousePressed(e);
                }
            }

            @Override
            protected int getSelectionIndex(LegendItemEntity entity) {
                return entity != null ? dataset.indexOf(entity.getSeriesKey()) : -1;
            }
        });
        seriesSelectionModel.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    notification.forceRefresh();
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChart.enableSelection.addListSelectionListener.new ListSelectionListener with e -> {if(!e.getValueIsAdjusting()){notification.forceRefresh(); in method private enableSelection() : void from class ec.util.chart.swing.JTimeSeriesChart


    private void enableProperties() {
        addPropertyChangeListener(evt -> {
            notification.suspend();
            switch (evt.getPropertyName()) {
                case COLOR_SCHEME_SUPPORT_PROPERTY:
                    onColorSchemeSupportChange();
                    break;
                case LINE_THICKNESS_PROPERTY:
                    onLineThicknessChange();
                    break;
                case PERIOD_FORMAT_PROPERTY:
                    onPeriodFormatChange();
                    break;
                case VALUE_FORMAT_PROPERTY:
                    onValueFormatChange();
                    break;
                case SERIES_RENDERER_PROPERTY:
                    onSeriesRendererChange();
                    break;
                case SERIES_FORMATTER_PROPERTY:
                    onSeriesFormatterChange();
                    break;
                case SERIES_COLORIST_PROPERTY:
                    onSeriesColoristChange();
                    break;
                case OBS_FORMATTER_PROPERTY:
                    onObsFormatterChange();
                    break;
                case OBS_COLORIST_PROPERTY:
                    onObsColoristChange();
                    break;
                case DASH_PREDICATE_PROPERTY:
                    onDashPredicateChange();
                    break;
                case LEGEND_VISIBILITY_PREDICATE_PROPERTY:
                    onLegendVisibilityPredicateChange();
                    break;
                case PLOT_DISPATCHER_PROPERTY:
                    onPlotDispatcherChange();
                    break;
                case DATASET_PROPERTY:
                    onDatasetChange();
                    break;
                case TITLE_PROPERTY:
                    onTitleChange();
                    break;
                case NO_DATA_MESSAGE_PROPERTY:
                    onNoDataMessageChange();
                    break;
                case PLOT_WEIGHTS_PROPERTY:
                    onPlotWeightsChange();
                    break;
                case ELEMENT_VISIBLE_PROPERTY:
                    onElementVisibleChange();
                    break;
                case CROSSHAIR_ORIENTATION_PROPERTY:
                    onCrosshairOrientationChange();
                    break;
                case HOVERED_OBS_PROPERTY:
                    onHoveredObsChange();
                    break;
                case SELECTED_OBS_PROPERTY:
                    onSelectedObsChange();
                    break;
                case OBS_HIGHLIGHTER_PROPERTY:
                    onObsHighlighterChange();
                    break;
                case TOOLTIP_TRIGGER_PROPERTY:
                    onTooltipTriggerChange();
                    break;
                case CROSSHAIR_TRIGGER_PROPERTY:
                    onCrosshairTriggerChange();
                    break;
                case REVEAL_OBS_PROPERTY:
                    onRevealObsChange();
                    break;
                case "enabled":
                    boolean enabled1 = isEnabled();
                    chartPanel.setDomainZoomable(enabled1);
                    chartPanel.setRangeZoomable(enabled1);
                    break;
                case "componentPopupMenu":
                    onComponentPopupMenuChange();
                    break;
            }
            notification.resume();
        });
    }

    private void enableProperties() {
        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                notification.suspend();
                switch (evt.getPropertyName()) {
                    case COLOR_SCHEME_SUPPORT_PROPERTY:
                        onColorSchemeSupportChange();
                        break;
                    case LINE_THICKNESS_PROPERTY:
                        onLineThicknessChange();
                        break;
                    case PERIOD_FORMAT_PROPERTY:
                        onPeriodFormatChange();
                        break;
                    case VALUE_FORMAT_PROPERTY:
                        onValueFormatChange();
                        break;
                    case SERIES_RENDERER_PROPERTY:
                        onSeriesRendererChange();
                        break;
                    case SERIES_FORMATTER_PROPERTY:
                        onSeriesFormatterChange();
                        break;
                    case SERIES_COLORIST_PROPERTY:
                        onSeriesColoristChange();
                        break;
                    case OBS_FORMATTER_PROPERTY:
                        onObsFormatterChange();
                        break;
                    case OBS_COLORIST_PROPERTY:
                        onObsColoristChange();
                        break;
                    case DASH_PREDICATE_PROPERTY:
                        onDashPredicateChange();
                        break;
                    case LEGEND_VISIBILITY_PREDICATE_PROPERTY:
                        onLegendVisibilityPredicateChange();
                        break;
                    case PLOT_DISPATCHER_PROPERTY:
                        onPlotDispatcherChange();
                        break;
                    case DATASET_PROPERTY:
                        onDatasetChange();
                        break;
                    case TITLE_PROPERTY:
                        onTitleChange();
                        break;
                    case NO_DATA_MESSAGE_PROPERTY:
                        onNoDataMessageChange();
                        break;
                    case PLOT_WEIGHTS_PROPERTY:
                        onPlotWeightsChange();
                        break;
                    case ELEMENT_VISIBLE_PROPERTY:
                        onElementVisibleChange();
                        break;
                    case CROSSHAIR_ORIENTATION_PROPERTY:
                        onCrosshairOrientationChange();
                        break;
                    case HOVERED_OBS_PROPERTY:
                        onHoveredObsChange();
                        break;
                    case SELECTED_OBS_PROPERTY:
                        onSelectedObsChange();
                        break;
                    case OBS_HIGHLIGHTER_PROPERTY:
                        onObsHighlighterChange();
                        break;
                    case TOOLTIP_TRIGGER_PROPERTY:
                        onTooltipTriggerChange();
                        break;
                    case CROSSHAIR_TRIGGER_PROPERTY:
                        onCrosshairTriggerChange();
                        break;
                    case REVEAL_OBS_PROPERTY:
                        onRevealObsChange();
                        break;
                    case "enabled":
                        boolean enabled = isEnabled();
                        chartPanel.setDomainZoomable(enabled);
                        chartPanel.setRangeZoomable(enabled);
                        break;
                    case "componentPopupMenu":
                        onComponentPopupMenuChange();
                        break;
                }
                notification.resume();
            }
        });
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChart.enableProperties.addPropertyChangeListener.new PropertyChangeListener with evt -> {notification.suspend(); in method private enableProperties() : void from class ec.util.chart.swing.JTimeSeriesChart


    FileFilter normalizedFilter(String term) {
        final String normalizedTerm = getNormalizedString(term);
        return (File o) -> (fileFilter == null || fileFilter.accept(o)) && getNormalizedString(o.getPath()).startsWith(normalizedTerm);
    }

    FileFilter normalizedFilter(String term) {
        final String normalizedTerm = getNormalizedString(term);
        return new FileFilter() {
            @Override
            public boolean accept(File o) {
                return (fileFilter == null || fileFilter.accept(o)) && getNormalizedString(o.getPath()).startsWith(normalizedTerm);
            }
        };
    }

Replace Anonymous With Lambda ec.util.completion.FileAutoCompletionSource.normalizedFilter.new FileFilter with (o) -> (fileFilter == null || fileFilter.accept(o)) && getNormalizedString(o.getPath()).startsWith(normalizedTerm) in method package normalizedFilter(term String) : FileFilter from class ec.util.completion.FileAutoCompletionSource


        DefaultFilter(long delay, TimeUnit unit) {
            this.evictor = new Timer((int) TimeUnit.MILLISECONDS.convert(delay, unit), evt -> clear());
            evictor.setRepeats(false);
        }

        DefaultFilter(long delay, TimeUnit unit) {
            this.evictor = new Timer((int) TimeUnit.MILLISECONDS.convert(delay, unit), new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    clear();
                }
            });
            evictor.setRepeats(false);
        }

Replace Anonymous With Lambda ec.util.completion.swing.FileListCellRenderer.DefaultFilter.DefaultFilter.new Timer.new ActionListener with evt -> clear() in method package DefaultFilter(delay long, unit TimeUnit) from class ec.util.completion.swing.FileListCellRenderer.DefaultFilter


        void fireDocumentEvent(DocumentEvent e) {
            if (listening) {
                SwingUtilities.invokeLater(() -> {
                    String current = getTerm();
                    if (!current.equals(previous)) {
                        previous = current;
                        timer.restart();
                    }
                });
            }
        }

        void fireDocumentEvent(DocumentEvent e) {
            if (listening) {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        String current = getTerm();
                        if (!current.equals(previous)) {
                            previous = current;
                            timer.restart();
                        }
                    }
                });
            }
        }

Replace Anonymous With Lambda ec.util.completion.swing.JAutoCompletion.JTextComponentInputView.fireDocumentEvent.invokeLater.new Runnable with () -> {String current=getTerm(); in method package fireDocumentEvent(e DocumentEvent) : void from class ec.util.completion.swing.JAutoCompletion.JTextComponentInputView


    public JAutoCompletion(@Nonnull JTextComponent input, @Nonnull JList list) {
        this.inputView = new JTextComponentInputView(input);
        this.searchView = new JListSearchView(list);
        this.timer = new Timer(delay, new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                search();
            }
        });
        this.timer.setRepeats(false);
        this.latestId = 0;
        addPropertyChangeListener(evt -> {
            String p = evt.getPropertyName();
            if (p.equals(DELAY_PROPERTY)) {
                timer.setDelay(delay);
            }
        });
    }

    public JAutoCompletion(@Nonnull JTextComponent input, @Nonnull JList list) {
        this.inputView = new JTextComponentInputView(input);
        this.searchView = new JListSearchView(list);
        this.timer = new Timer(delay, new AbstractAction() {
            @Override
            public void actionPerformed(ActionEvent e) {
                search();
            }
        });
        this.timer.setRepeats(false);
        this.latestId = 0;
        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                String p = evt.getPropertyName();
                if (p.equals(DELAY_PROPERTY)) {
                    timer.setDelay(delay);
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.completion.swing.JAutoCompletion.JAutoCompletion.addPropertyChangeListener.new PropertyChangeListener with evt -> {String p=evt.getPropertyName(); in method public JAutoCompletion(input JTextComponent, list JList) from class ec.util.completion.swing.JAutoCompletion


        @Override
        public void installUI(JComponent c) {
            super.installUI(c);
            dropTarget = new DropTarget(scrollPane, new ForwardingListener() {

                @Override
                protected DropTarget getDelegate() {
                    return main.getDropTarget();
                }

                @Override
                public void dragEnter(DropTargetDragEvent dtde) {
                    super.dragEnter(dtde);
                    // FIXME: value still set to true even if import refused
                    setHasDropLocation(true);
                }

                @Override
                public void dragExit(DropTargetEvent dte) {
                    super.dragExit(dte);
                    setHasDropLocation(false);
                }

                @Override
                public void drop(DropTargetDropEvent dtde) {
                    super.drop(dtde);
                    setHasDropLocation(false);
                }
            });
            PropertyChangeListener listener = evt -> {
                switch (evt.getPropertyName()) {
                    case "dropLocation":
                        JTable table = (JTable) evt.getSource();
                        setHasDropLocation(table.getDropLocation() != null);
                        break;
                }
            };
            main.addPropertyChangeListener(listener);
            fct.getFixedTable().addPropertyChangeListener(listener);
        }

        @Override
        public void installUI(JComponent c) {
            super.installUI(c);
            dropTarget = new DropTarget(scrollPane, new ForwardingListener() {

                @Override
                protected DropTarget getDelegate() {
                    return main.getDropTarget();
                }

                @Override
                public void dragEnter(DropTargetDragEvent dtde) {
                    super.dragEnter(dtde);
                    // FIXME: value still set to true even if import refused
                    setHasDropLocation(true);
                }

                @Override
                public void dragExit(DropTargetEvent dte) {
                    super.dragExit(dte);
                    setHasDropLocation(false);
                }

                @Override
                public void drop(DropTargetDropEvent dtde) {
                    super.drop(dtde);
                    setHasDropLocation(false);
                }
            });
            PropertyChangeListener listener = new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    switch (evt.getPropertyName()) {
                        case "dropLocation":
                            JTable table = (JTable) evt.getSource();
                            setHasDropLocation(table.getDropLocation() != null);
                            break;
                    }
                }
            };
            main.addPropertyChangeListener(listener);
            fct.getFixedTable().addPropertyChangeListener(listener);
        }

Replace Anonymous With Lambda ec.util.grid.swing.JGrid.NoDataUI.installUI.listener.new PropertyChangeListener with evt -> {switch(evt.getPropertyName())case "dropLocation":JTable table=(JTable)evt.getSource(); in method public installUI(c JComponent) : void from class ec.util.grid.swing.JGrid.NoDataUI


    private void initComponents() {
        main.setModel(internalModel);
        main.setOddBackground(null);

        // This makes sure user can drop on all component and not only on present cell
        main.setFillsViewportHeight(true);

        main.getTableHeader().setReorderingAllowed(false);
        main.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

        scrollPane.setViewportView(main);

        // This makes the viewport background same as table background
        // http://www.jroller.com/santhosh/date/20050524#jtable_becomes_uglier_with_auto
        scrollPane.getViewport().setBackground(main.getBackground());

        fct.getFixedTable().getTableHeader().setReorderingAllowed(false);
        fct.getFixedTable().setFillsViewportHeight(true);
        fct.getFixedTable().setIntercellSpacing(new Dimension(0, 0));
        fct.getFixedTable().setShowGrid(false);

        // FixedColumnTable#makeColumns(int) doesn't use zoomRatio, so we have to apply it afterwards
        internalModel.addTableModelListener(evt -> {
            if (evt.getType() == TableModelEvent.UPDATE) {
                applyZoomRatioOnColumnsWidth();
            }
        });

        setRowRenderer(new RowRenderer(this));
        setColumnRenderer(new ColumnRenderer(this));
        setCornerRenderer(new CornerRenderer());
        setDefaultRenderer(Object.class, new GridCellRenderer(this));

        onModelChange();
        onRowSelectionAllowedChange();
        onColumnSelectionAllowedChange();
        onDragEnabledChange();
        onGridColorChange();
        onNoDataRendererChange();
        onTransferHandlerChange();
        onRowSelectionModelChange();
        onColumnSelectionModelChange();
        onComponentPopupMenuChange();
    }

    private void initComponents() {
        main.setModel(internalModel);
        main.setOddBackground(null);

        // This makes sure user can drop on all component and not only on present cell
        main.setFillsViewportHeight(true);

        main.getTableHeader().setReorderingAllowed(false);
        main.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);

        scrollPane.setViewportView(main);

        // This makes the viewport background same as table background
        // http://www.jroller.com/santhosh/date/20050524#jtable_becomes_uglier_with_auto
        scrollPane.getViewport().setBackground(main.getBackground());

        fct.getFixedTable().getTableHeader().setReorderingAllowed(false);
        fct.getFixedTable().setFillsViewportHeight(true);
        fct.getFixedTable().setIntercellSpacing(new Dimension(0, 0));
        fct.getFixedTable().setShowGrid(false);

        // FixedColumnTable#makeColumns(int) doesn't use zoomRatio, so we have to apply it afterwards
        internalModel.addTableModelListener(new TableModelListener() {
            @Override
            public void tableChanged(TableModelEvent e) {
                if (e.getType() == TableModelEvent.UPDATE) {
                    applyZoomRatioOnColumnsWidth();
                }
            }
        });

        setRowRenderer(new RowRenderer(this));
        setColumnRenderer(new ColumnRenderer(this));
        setCornerRenderer(new CornerRenderer());
        setDefaultRenderer(Object.class, new GridCellRenderer(this));

        onModelChange();
        onRowSelectionAllowedChange();
        onColumnSelectionAllowedChange();
        onDragEnabledChange();
        onGridColorChange();
        onNoDataRendererChange();
        onTransferHandlerChange();
        onRowSelectionModelChange();
        onColumnSelectionModelChange();
        onComponentPopupMenuChange();
    }

Replace Anonymous With Lambda ec.util.grid.swing.JGrid.initComponents.addTableModelListener.new TableModelListener with evt -> {if(evt.getType() == TableModelEvent.UPDATE){applyZoomRatioOnColumnsWidth(); in method private initComponents() : void from class ec.util.grid.swing.JGrid


    private void enableProperties() {
        addPropertyChangeListener(evt -> {
            switch (evt.getPropertyName()) {
                case MODEL_PROPERTY:
                    onModelChange();
                    break;
                case ROW_SELECTION_ALLOWED_PROPERTY:
                    onRowSelectionAllowedChange();
                    break;
                case COLUMN_SELECTION_ALLOWED_PROPERTY:
                    onColumnSelectionAllowedChange();
                    break;
                case HOVERED_CELL_PROPERTY:
                    onHoveredCellChange();
                    break;
                case SELECTED_CELL_PROPERTY:
                    onSelectedCellChange();
                    break;
                case CROSSHAIR_VISIBLE_PROPERTY:
                    onCrosshairVisibleChange();
                    break;
                case DRAG_ENABLED_PROPERTY:
                    onDragEnabledChange();
                    break;
                case GRID_COLOR_PROPERTY:
                    onGridColorChange();
                    break;
                case NO_DATA_RENDERER_PROPERTY:
                    onNoDataRendererChange();
                    break;
                case ROW_SELECTION_MODEL_PROPERTY:
                    onRowSelectionModelChange();
                    break;
                case COLUMN_SELECTION_MODEL_PROPERTY:
                    onColumnSelectionModelChange();
                    break;
                case "font":
                    onFontChange();
                    break;
                case "transferHandler":
                    onTransferHandlerChange();
                    break;
                case "componentPopupMenu":
                    onComponentPopupMenuChange();
                    break;
            }
        });
    }

    private void enableProperties() {
        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                switch (evt.getPropertyName()) {
                    case MODEL_PROPERTY:
                        onModelChange();
                        break;
                    case ROW_SELECTION_ALLOWED_PROPERTY:
                        onRowSelectionAllowedChange();
                        break;
                    case COLUMN_SELECTION_ALLOWED_PROPERTY:
                        onColumnSelectionAllowedChange();
                        break;
                    case HOVERED_CELL_PROPERTY:
                        onHoveredCellChange();
                        break;
                    case SELECTED_CELL_PROPERTY:
                        onSelectedCellChange();
                        break;
                    case CROSSHAIR_VISIBLE_PROPERTY:
                        onCrosshairVisibleChange();
                        break;
                    case DRAG_ENABLED_PROPERTY:
                        onDragEnabledChange();
                        break;
                    case GRID_COLOR_PROPERTY:
                        onGridColorChange();
                        break;
                    case NO_DATA_RENDERER_PROPERTY:
                        onNoDataRendererChange();
                        break;
                    case ROW_SELECTION_MODEL_PROPERTY:
                        onRowSelectionModelChange();
                        break;
                    case COLUMN_SELECTION_MODEL_PROPERTY:
                        onColumnSelectionModelChange();
                        break;
                    case "font":
                        onFontChange();
                        break;
                    case "transferHandler":
                        onTransferHandlerChange();
                        break;
                    case "componentPopupMenu":
                        onComponentPopupMenuChange();
                        break;
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.grid.swing.JGrid.enableProperties.addPropertyChangeListener.new PropertyChangeListener with evt -> {switch(evt.getPropertyName())case MODEL_PROPERTY:onModelChange(); in method private enableProperties() : void from class ec.util.grid.swing.JGrid


    private static void enableDragOnHeader(final JTableHeader tableHeader) {
        DragSource dragSource = DragSource.getDefaultDragSource();
        dragSource.createDefaultDragGestureRecognizer(tableHeader, DnDConstants.ACTION_COPY_OR_MOVE, evt -> {
            if (tableHeader.getResizingColumn() == null) {
                TransferHandler transferHandler = tableHeader.getTransferHandler();
                if (transferHandler != null) {
                    transferHandler.exportAsDrag(tableHeader, evt.getTriggerEvent(), TransferHandler.COPY);
                }
            }
        });
    }

    private static void enableDragOnHeader(final JTableHeader tableHeader) {
        DragSource dragSource = DragSource.getDefaultDragSource();
        dragSource.createDefaultDragGestureRecognizer(tableHeader, DnDConstants.ACTION_COPY_OR_MOVE, new DragGestureListener() {
            @Override
            public void dragGestureRecognized(DragGestureEvent dge) {
                if (tableHeader.getResizingColumn() == null) {
                    TransferHandler transferHandler = tableHeader.getTransferHandler();
                    if (transferHandler != null) {
                        transferHandler.exportAsDrag(tableHeader, dge.getTriggerEvent(), TransferHandler.COPY);
                    }
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.grid.swing.JGrid.enableDragOnHeader.createDefaultDragGestureRecognizer.new DragGestureListener with evt -> {if(tableHeader.getResizingColumn() == null){TransferHandler transferHandler=tableHeader.getTransferHandler(); in method private enableDragOnHeader(tableHeader JTableHeader) : void from class ec.util.grid.swing.JGrid


    public XTable() {
        cellPadding = UIManager.getDimension(CELL_PADDING_PROPERTY);
        if (cellPadding == null) {
            cellPadding = DEFAULT_CELL_PADDING;
        }
        oddBackground = UIManager.getColor(ODD_BACKGROUND_PROPERTY);
        if (oddBackground == null) {
            oddBackground = DEFAULT_ODD_BACKGROUND;
        }
        noDataRenderer = DEFAULT_NO_DATA_RENDERER;

        Color newGridColor = StandardSwingColor.CONTROL.value();
        if (newGridColor != null) {
            setGridColor(newGridColor);
        }

        this.cellBorder = new PaddingBorder();
        hasDropLocation = false;
        toolTipFactory = null;

        onCellPaddingChange();

        addPropertyChangeListener(evt -> {
            switch (evt.getPropertyName()) {
                case "dropLocation":
                    hasDropLocation = evt.getNewValue() != null;
                    onNoDataRendererChange();
                    break;
                case CELL_PADDING_PROPERTY:
                    onCellPaddingChange();
                    break;
                case ODD_BACKGROUND_PROPERTY:
                    onOddBackgroundChange();
                    break;
                case NO_DATA_RENDERER_PROPERTY:
                    onNoDataRendererChange();
                    break;
            }
        });
    }

    public XTable() {
        cellPadding = UIManager.getDimension(CELL_PADDING_PROPERTY);
        if (cellPadding == null) {
            cellPadding = DEFAULT_CELL_PADDING;
        }
        oddBackground = UIManager.getColor(ODD_BACKGROUND_PROPERTY);
        if (oddBackground == null) {
            oddBackground = DEFAULT_ODD_BACKGROUND;
        }
        noDataRenderer = DEFAULT_NO_DATA_RENDERER;

        Color newGridColor = StandardSwingColor.CONTROL.value();
        if (newGridColor != null) {
            setGridColor(newGridColor);
        }

        this.cellBorder = new PaddingBorder();
        hasDropLocation = false;
        toolTipFactory = null;

        onCellPaddingChange();

        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                switch (evt.getPropertyName()) {
                    case "dropLocation":
                        hasDropLocation = evt.getNewValue() != null;
                        onNoDataRendererChange();
                        break;
                    case CELL_PADDING_PROPERTY:
                        onCellPaddingChange();
                        break;
                    case ODD_BACKGROUND_PROPERTY:
                        onOddBackgroundChange();
                        break;
                    case NO_DATA_RENDERER_PROPERTY:
                        onNoDataRendererChange();
                        break;
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.grid.swing.XTable.XTable.addPropertyChangeListener.new PropertyChangeListener with evt -> {switch(evt.getPropertyName())case "dropLocation":hasDropLocation=evt.getNewValue() != null; in method public XTable() from class ec.util.grid.swing.XTable


    public BasicFileViewer() {
        this.viewer = null;
        this.state = State.READY;
        this.fileHandler = null;
        this.file = null;
        this.startRenderer = DefaultStartRenderer.INSTANCE;
        this.dragRenderer = DefaultDragRenderer.INSTANCE;
        this.loadRenderer = DefaultLoadRenderer.INSTANCE;
        this.failureRenderer = DefaultFailureRenderer.INSTANCE;

        setTransferHandler(new FileTransferHandler());
        try {
            getDropTarget().addDropTargetListener(new DropTargetAdapter() {
                State saved;

                @Override
                public void dragEnter(DropTargetDragEvent dtde) {
                    if (state != State.LOADING) {
                        dragEvent = dtde;
                        saved = state;
                        setState(State.DRAGGING);
                    }
                }

                @Override
                public void dragExit(DropTargetEvent dte) {
                    if (state != State.LOADING) {
                        setState(saved);
                    }
                }

                @Override
                public void drop(DropTargetDropEvent dtde) {
                    dragExit(dtde);
                }
            });
        } catch (TooManyListenersException ex) {
            Logger.getLogger(BasicFileViewer.class.getName()).log(Level.SEVERE, null, ex);
        }

        addPropertyChangeListener(evt -> {
            switch (evt.getPropertyName()) {
                case STATE_PROPERTY:
                    onStateChange();
                    break;
                case FILE_HANDLER_PROPERTY:
                    onFileHandlerChange();
                    break;
                case FILE_PROPERTY:
                    onFileChange();
                    break;
            }
        });

        setLayout(new BorderLayout());
        add(startRenderer.getStartComponent(), BorderLayout.CENTER);
    }

    public BasicFileViewer() {
        this.viewer = null;
        this.state = State.READY;
        this.fileHandler = null;
        this.file = null;
        this.startRenderer = DefaultStartRenderer.INSTANCE;
        this.dragRenderer = DefaultDragRenderer.INSTANCE;
        this.loadRenderer = DefaultLoadRenderer.INSTANCE;
        this.failureRenderer = DefaultFailureRenderer.INSTANCE;

        setTransferHandler(new FileTransferHandler());
        try {
            getDropTarget().addDropTargetListener(new DropTargetAdapter() {
                State saved;

                @Override
                public void dragEnter(DropTargetDragEvent dtde) {
                    if (state != State.LOADING) {
                        dragEvent = dtde;
                        saved = state;
                        setState(State.DRAGGING);
                    }
                }

                @Override
                public void dragExit(DropTargetEvent dte) {
                    if (state != State.LOADING) {
                        setState(saved);
                    }
                }

                @Override
                public void drop(DropTargetDropEvent dtde) {
                    dragExit(dtde);
                }
            });
        } catch (TooManyListenersException ex) {
            Logger.getLogger(BasicFileViewer.class.getName()).log(Level.SEVERE, null, ex);
        }

        addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                switch (evt.getPropertyName()) {
                    case STATE_PROPERTY:
                        onStateChange();
                        break;
                    case FILE_HANDLER_PROPERTY:
                        onFileHandlerChange();
                        break;
                    case FILE_PROPERTY:
                        onFileChange();
                        break;
                }
            }
        });

        setLayout(new BorderLayout());
        add(startRenderer.getStartComponent(), BorderLayout.CENTER);
    }

Replace Anonymous With Lambda ec.util.various.swing.BasicFileViewer.BasicFileViewer.addPropertyChangeListener.new PropertyChangeListener with evt -> {switch(evt.getPropertyName())case STATE_PROPERTY:onStateChange(); in method public BasicFileViewer() from class ec.util.various.swing.BasicFileViewer


            @Override
            protected Object doInBackground() throws Exception {
                return fileHandler.asyncLoad(file, (min, max, value) -> publish((value - min) * 100 / (max - min)));
            }

            @Override
            protected Object doInBackground() throws Exception {
                return fileHandler.asyncLoad(file, new ProgressCallback() {
                    @Override
                    public void setProgress(int min, int max, int value) {
                        publish((value - min) * 100 / (max - min));
                    }
                });
            }

Replace Anonymous With Lambda ec.util.various.swing.BasicFileViewer.onFileChange.execute.new SwingWorker<Object,Integer>.doInBackground.asyncLoad.new ProgressCallback with (min, max, value) -> publish((value - min) * 100 / (max - min)) in method protected doInBackground() : Object from class ec.util.various.swing.BasicFileViewer.onFileChange.execute.new SwingWorker<Object,Integer>


    private static void launch(
            @Nonnull final String lookAndFeelClassName,
            @Nonnull final String title,
            @Nonnull final Dimension size,
            @Nonnull final Callable<? extends Component> contentSupplier,
            @Nonnull final Callable<? extends List<? extends Image>> iconsSupplier,
            final boolean centerOnScreen, final boolean resizable) {

        LOGGER.log(Level.FINE, "lookAndFeelClassName='%s'", lookAndFeelClassName);
        LOGGER.log(Level.FINE, "title='{0}'", title);
        LOGGER.log(Level.FINE, "size='{0}'", size);
        LOGGER.log(Level.FINE, "contentSupplier='{0}'", contentSupplier);
        LOGGER.log(Level.FINE, "centerOnScreen='{0}'", centerOnScreen);

        try {
            UIManager.setLookAndFeel(lookAndFeelClassName);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            LOGGER.log(Level.WARNING, "Cannot set look&feel", ex);
        }

        SwingUtilities.invokeLater(() -> {
            try {
                JFrame frame = new JFrame();
                frame.setTitle(title);
                frame.setIconImages(iconsSupplier.call());
                frame.getContentPane().add(contentSupplier.call());
                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                frame.setSize(size);
                frame.setResizable(resizable);
                if (centerOnScreen) {
                    frame.setLocationRelativeTo(null);
                }
                frame.setVisible(true);
            } catch (Exception ex) {
                LOGGER.log(Level.SEVERE, "Cannot launch app", ex);
            }
        });
    }

    private static void launch(
            @Nonnull final String lookAndFeelClassName,
            @Nonnull final String title,
            @Nonnull final Dimension size,
            @Nonnull final Callable<? extends Component> contentSupplier,
            @Nonnull final Callable<? extends List<? extends Image>> iconsSupplier,
            final boolean centerOnScreen, final boolean resizable) {

        LOGGER.log(Level.FINE, "lookAndFeelClassName='%s'", lookAndFeelClassName);
        LOGGER.log(Level.FINE, "title='{0}'", title);
        LOGGER.log(Level.FINE, "size='{0}'", size);
        LOGGER.log(Level.FINE, "contentSupplier='{0}'", contentSupplier);
        LOGGER.log(Level.FINE, "centerOnScreen='{0}'", centerOnScreen);

        try {
            UIManager.setLookAndFeel(lookAndFeelClassName);
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
            LOGGER.log(Level.WARNING, "Cannot set look&feel", ex);
        }

        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                try {
                    JFrame frame = new JFrame();
                    frame.setTitle(title);
                    frame.setIconImages(iconsSupplier.call());
                    frame.getContentPane().add(contentSupplier.call());
                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    frame.setSize(size);
                    frame.setResizable(resizable);
                    if (centerOnScreen) {
                        frame.setLocationRelativeTo(null);
                    }
                    frame.setVisible(true);
                } catch (Exception ex) {
                    LOGGER.log(Level.SEVERE, "Cannot launch app", ex);
                }
            }
        });
    }

Replace Anonymous With Lambda ec.util.various.swing.BasicSwingLauncher.launch.invokeLater.new Runnable with () -> {tryJFrame frame=new JFrame(); in method private launch(lookAndFeelClassName String, title String, size Dimension, contentSupplier Callable<? extends Component>, iconsSupplier Callable<? extends List<? extends Image>>, centerOnScreen boolean, resizable boolean) : void from class ec.util.various.swing.BasicSwingLauncher


        /**
         * Register a property change listener on a component. This listener
         * uses a weak reference to avoid memory leaks.
         *
         * @param source a non-null component
         * @param properties a list of properties to listen to
         * @return itself
         */
        @Nonnull
        public ActionAdapter withWeakPropertyChangeListener(@Nonnull Component source, @Nonnull String... properties) {
            PropertyChangeListener realListener = evt -> refreshActionState();
            putValue("PropertyChangeListener", realListener);
            if (properties.length > 0) {
                for (final String property : properties) {
                    source.addPropertyChangeListener(property, new WeakPropertyChangeListener(realListener) {
                        @Override
                        protected void unregister(Object source) {
                            ((Component) source).removePropertyChangeListener(property, this);
                        }
                    });
                }
            } else {
                source.addPropertyChangeListener(new WeakPropertyChangeListener(realListener) {
                    @Override
                    protected void unregister(Object source) {
                        ((Component) source).removePropertyChangeListener(this);
                    }
                });
            }
            return this;
        }

        /**
         * Register a property change listener on a component. This listener
         * uses a weak reference to avoid memory leaks.
         *
         * @param source a non-null component
         * @param properties a list of properties to listen to
         * @return itself
         */
        @Nonnull
        public ActionAdapter withWeakPropertyChangeListener(@Nonnull Component source, @Nonnull String... properties) {
            PropertyChangeListener realListener = new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    refreshActionState();
                }
            };
            putValue("PropertyChangeListener", realListener);
            if (properties.length > 0) {
                for (final String property : properties) {
                    source.addPropertyChangeListener(property, new WeakPropertyChangeListener(realListener) {
                        @Override
                        protected void unregister(Object source) {
                            ((Component) source).removePropertyChangeListener(property, this);
                        }
                    });
                }
            } else {
                source.addPropertyChangeListener(new WeakPropertyChangeListener(realListener) {
                    @Override
                    protected void unregister(Object source) {
                        ((Component) source).removePropertyChangeListener(this);
                    }
                });
            }
            return this;
        }

Replace Anonymous With Lambda ec.util.various.swing.JCommand.ActionAdapter.withWeakPropertyChangeListener.realListener.new PropertyChangeListener with evt -> refreshActionState() in method public withWeakPropertyChangeListener(source Component, properties String...) : ActionAdapter from class ec.util.various.swing.JCommand.ActionAdapter


        /**
         * Register a list selection listener on a list selection model. This
         * listener uses a weak reference to avoid memory leaks.
         *
         * @param source a non-null list selection model
         * @return itself
         */
        @Nonnull
        public ActionAdapter withWeakListSelectionListener(@Nonnull ListSelectionModel source) {
            ListSelectionListener realListener = evt -> refreshActionState();
            putValue("ListSelectionListener", realListener);
            source.addListSelectionListener(new WeakListSelectionListener(realListener) {
                @Override
                protected void unregister(Object source) {
                    ((ListSelectionModel) source).removeListSelectionListener(this);
                }
            });
            return this;
        }

        /**
         * Register a list selection listener on a list selection model. This
         * listener uses a weak reference to avoid memory leaks.
         *
         * @param source a non-null list selection model
         * @return itself
         */
        @Nonnull
        public ActionAdapter withWeakListSelectionListener(@Nonnull ListSelectionModel source) {
            ListSelectionListener realListener = new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent e) {
                    refreshActionState();
                }
            };
            putValue("ListSelectionListener", realListener);
            source.addListSelectionListener(new WeakListSelectionListener(realListener) {
                @Override
                protected void unregister(Object source) {
                    ((ListSelectionModel) source).removeListSelectionListener(this);
                }
            });
            return this;
        }

Replace Anonymous With Lambda ec.util.various.swing.JCommand.ActionAdapter.withWeakListSelectionListener.realListener.new ListSelectionListener with evt -> refreshActionState() in method public withWeakListSelectionListener(source ListSelectionModel) : ActionAdapter from class ec.util.various.swing.JCommand.ActionAdapter


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(ColorSchemeDemo.class)
                .title("Color Scheme Demo")
                .icons(() -> FontAwesome.FA_PAINT_BRUSH.getImages(Color.DARK_GRAY, 16f, 32f, 64f))
                .size(300, 400)
                .logLevel(Level.FINE)
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(ColorSchemeDemo.class)
                .title("Color Scheme Demo")
                .icons(new Callable<List<? extends Image>>() {
                    @Override
                    public List<? extends Image> call() throws Exception {
                        return FontAwesome.FA_PAINT_BRUSH.getImages(Color.DARK_GRAY, 16f, 32f, 64f);
                    }
                })
                .size(300, 400)
                .logLevel(Level.FINE)
                .launch();
    }

Replace Anonymous With Lambda ec.util.chart.swing.ColorSchemeDemo.main.launch.logLevel.size.icons.new Callable<List<? extends Image>> with () -> FontAwesome.FA_PAINT_BRUSH.getImages(Color.DARK_GRAY,16f,32f,64f) in method public main(args String[]) : void from class ec.util.chart.swing.ColorSchemeDemo


    public ColorSchemeDemo() {
        JComboBox<ColorScheme> colorScheme = new JComboBox<>(getColorSchemes());
        colorScheme.setRenderer(new ColorSchemeRenderer());

        final JList<Integer> colors = new JList<>();
        colors.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        colors.setVisibleRowCount(-1);
        colors.setCellRenderer(new ColorRenderer());

        colorScheme.addItemListener(e -> applyColorScheme((ColorScheme) e.getItem(), colors));

        applyColorScheme((ColorScheme) colorScheme.getSelectedItem(), colors);

        setLayout(new BorderLayout());
        add(BorderLayout.NORTH, colorScheme);
        add(BorderLayout.CENTER, ModernUI.withEmptyBorders(new JScrollPane(colors)));
    }

    public ColorSchemeDemo() {
        JComboBox<ColorScheme> colorScheme = new JComboBox<>(getColorSchemes());
        colorScheme.setRenderer(new ColorSchemeRenderer());

        final JList<Integer> colors = new JList<>();
        colors.setLayoutOrientation(JList.HORIZONTAL_WRAP);
        colors.setVisibleRowCount(-1);
        colors.setCellRenderer(new ColorRenderer());

        colorScheme.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                applyColorScheme((ColorScheme) e.getItem(), colors);
            }
        });

        applyColorScheme((ColorScheme) colorScheme.getSelectedItem(), colors);

        setLayout(new BorderLayout());
        add(BorderLayout.NORTH, colorScheme);
        add(BorderLayout.CENTER, ModernUI.withEmptyBorders(new JScrollPane(colors)));
    }

Replace Anonymous With Lambda ec.util.chart.swing.ColorSchemeDemo.ColorSchemeDemo.addItemListener.new ItemListener with e -> applyColorScheme((ColorScheme)e.getItem(),colors) in method public ColorSchemeDemo() from class ec.util.chart.swing.ColorSchemeDemo


        public void enable(final JTimeSeriesChart chart) {
            updateColors(chart);
            chart.addPropertyChangeListener(evt -> {
                switch (evt.getPropertyName()) {
                    case JTimeSeriesChart.TOOLTIP_TRIGGER_PROPERTY:
                        if (popup != null) {
                            popup.hide();
                        }
                        break;
                    case JTimeSeriesChart.HOVERED_OBS_PROPERTY:
                        if (isEnabled() && chart.getTooltipTrigger() != DisplayTrigger.SELECTION) {
                            updateCustomTooltip(chart, chart.getObsExistPredicate().apply(chart.getHoveredObs()));
                        }
                        break;
                    case JTimeSeriesChart.SELECTED_OBS_PROPERTY:
                        if (isEnabled() && chart.getTooltipTrigger() != DisplayTrigger.HOVERING) {
                            updateCustomTooltip(chart, chart.getObsExistPredicate().apply(chart.getSelectedObs()));
                        }
                        break;
                    case JTimeSeriesChart.COLOR_SCHEME_SUPPORT_PROPERTY:
                        updateColors(chart);
                        break;
                }
            });
        }

        public void enable(final JTimeSeriesChart chart) {
            updateColors(chart);
            chart.addPropertyChangeListener(new PropertyChangeListener() {
                @Override
                public void propertyChange(PropertyChangeEvent evt) {
                    switch (evt.getPropertyName()) {
                        case JTimeSeriesChart.TOOLTIP_TRIGGER_PROPERTY:
                            if (popup != null) {
                                popup.hide();
                            }
                            break;
                        case JTimeSeriesChart.HOVERED_OBS_PROPERTY:
                            if (isEnabled() && chart.getTooltipTrigger() != DisplayTrigger.SELECTION) {
                                updateCustomTooltip(chart, chart.getObsExistPredicate().apply(chart.getHoveredObs()));
                            }
                            break;
                        case JTimeSeriesChart.SELECTED_OBS_PROPERTY:
                            if (isEnabled() && chart.getTooltipTrigger() != DisplayTrigger.HOVERING) {
                                updateCustomTooltip(chart, chart.getObsExistPredicate().apply(chart.getSelectedObs()));
                            }
                            break;
                        case JTimeSeriesChart.COLOR_SCHEME_SUPPORT_PROPERTY:
                            updateColors(chart);
                            break;
                    }
                }
            });
        }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChartDemo.CustomTooltip.enable.addPropertyChangeListener.new PropertyChangeListener with evt -> {switch(evt.getPropertyName())case JTimeSeriesChart.TOOLTIP_TRIGGER_PROPERTY:if(popup != null){popup.hide(); in method public enable(chart JTimeSeriesChart) : void from class ec.util.chart.swing.JTimeSeriesChartDemo.CustomTooltip


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(JTimeSeriesChartDemo.class)
                .title("Time Series Chart Demo")
                .icons(() -> FontAwesome.FA_LINE_CHART.getImages(Color.BLACK, 16f, 32f, 64f))
                .logLevel(Level.FINE)
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(JTimeSeriesChartDemo.class)
                .title("Time Series Chart Demo")
                .icons(new Callable<List<? extends Image>>() {
                    @Override
                    public List<? extends Image> call() throws Exception {
                        return FontAwesome.FA_LINE_CHART.getImages(Color.BLACK, 16f, 32f, 64f);
                    }
                })
                .logLevel(Level.FINE)
                .launch();
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChartDemo.main.launch.logLevel.icons.new Callable<List<? extends Image>> with () -> FontAwesome.FA_LINE_CHART.getImages(Color.BLACK,16f,32f,64f) in method public main(args String[]) : void from class ec.util.chart.swing.JTimeSeriesChartDemo


    private JMenu newTooltipMenu() {
        JMenu result = new JMenu("Tooltip");

        result.add(new JCheckBoxMenuItem(toggleElementVisibility(Element.TOOLTIP).toAction(chart))).setText("Default Tooltip");
        result.add(new JCheckBoxMenuItem(new ToggleCustomTooltip(chart).toAction(customTooltip))).setText("Custom tooltip");

        final JMenu trigger = new JMenu("Trigger");
        for (DisplayTrigger o : DisplayTrigger.values()) {
            trigger.add(new JCheckBoxMenuItem(applyTooltipTrigger(o).toAction(chart))).setText(o.name());
        }
        result.add(trigger);

        chart.addPropertyChangeListener(ELEMENT_VISIBLE_PROPERTY, evt -> {
            boolean enabled1 = chart.isElementVisible(Element.TOOLTIP);
            trigger.setEnabled(enabled1);
        });

        return result;
    }

    private JMenu newTooltipMenu() {
        JMenu result = new JMenu("Tooltip");

        result.add(new JCheckBoxMenuItem(toggleElementVisibility(Element.TOOLTIP).toAction(chart))).setText("Default Tooltip");
        result.add(new JCheckBoxMenuItem(new ToggleCustomTooltip(chart).toAction(customTooltip))).setText("Custom tooltip");

        final JMenu trigger = new JMenu("Trigger");
        for (DisplayTrigger o : DisplayTrigger.values()) {
            trigger.add(new JCheckBoxMenuItem(applyTooltipTrigger(o).toAction(chart))).setText(o.name());
        }
        result.add(trigger);

        chart.addPropertyChangeListener(ELEMENT_VISIBLE_PROPERTY, new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                boolean enabled = chart.isElementVisible(Element.TOOLTIP);
                trigger.setEnabled(enabled);
            }
        });

        return result;
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChartDemo.newTooltipMenu.addPropertyChangeListener.new PropertyChangeListener with evt -> {boolean enabled1=chart.isElementVisible(Element.TOOLTIP); in method private newTooltipMenu() : JMenu from class ec.util.chart.swing.JTimeSeriesChartDemo


    private JMenu newCrosshairMenu() {
        JMenu result = new JMenu("Crosshair");

        result.add(new JCheckBoxMenuItem(toggleElementVisibility(Element.CROSSHAIR).toAction(chart))).setText("Enabled");

        final JMenu orientation = new JMenu("Orientation");
        for (CrosshairOrientation o : CrosshairOrientation.values()) {
            orientation.add(new JCheckBoxMenuItem(applyCrosshairOrientation(o).toAction(chart))).setText(o.name());
        }
        orientation.setEnabled(false);
        result.add(orientation);

        final JMenu trigger = new JMenu("Trigger");
        for (DisplayTrigger o : DisplayTrigger.values()) {
            trigger.add(new JCheckBoxMenuItem(applyTooltipTrigger(o).toAction(chart))).setText(o.name());
        }
        trigger.setEnabled(false);
        result.add(trigger);

        chart.addPropertyChangeListener(ELEMENT_VISIBLE_PROPERTY, evt -> {
            boolean enabled1 = chart.isElementVisible(Element.CROSSHAIR);
            orientation.setEnabled(enabled1);
            trigger.setEnabled(enabled1);
        });

        return result;
    }

    private JMenu newCrosshairMenu() {
        JMenu result = new JMenu("Crosshair");

        result.add(new JCheckBoxMenuItem(toggleElementVisibility(Element.CROSSHAIR).toAction(chart))).setText("Enabled");

        final JMenu orientation = new JMenu("Orientation");
        for (CrosshairOrientation o : CrosshairOrientation.values()) {
            orientation.add(new JCheckBoxMenuItem(applyCrosshairOrientation(o).toAction(chart))).setText(o.name());
        }
        orientation.setEnabled(false);
        result.add(orientation);

        final JMenu trigger = new JMenu("Trigger");
        for (DisplayTrigger o : DisplayTrigger.values()) {
            trigger.add(new JCheckBoxMenuItem(applyTooltipTrigger(o).toAction(chart))).setText(o.name());
        }
        trigger.setEnabled(false);
        result.add(trigger);

        chart.addPropertyChangeListener(ELEMENT_VISIBLE_PROPERTY, new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                boolean enabled = chart.isElementVisible(Element.CROSSHAIR);
                orientation.setEnabled(enabled);
                trigger.setEnabled(enabled);
            }
        });

        return result;
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesChartDemo.newCrosshairMenu.addPropertyChangeListener.new PropertyChangeListener with evt -> {boolean enabled1=chart.isElementVisible(Element.CROSSHAIR); in method private newCrosshairMenu() : JMenu from class ec.util.chart.swing.JTimeSeriesChartDemo


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(JTimeSeriesRendererSupportDemo.class)
                .title("Support Demo")
                .icons(() -> {
                    Color c = new Color(TangoColorScheme.DARK_SKY_BLUE);
                    return FontAwesome.FA_TACHOMETER.getImages(c, 16f, 32f, 64f);
                })
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(JTimeSeriesRendererSupportDemo.class)
                .title("Support Demo")
                .icons(new Callable<List<Image>>() {
                    @Override
                    public List<Image> call() throws Exception {
                        Color c = new Color(TangoColorScheme.DARK_SKY_BLUE);
                        return FontAwesome.FA_TACHOMETER.getImages(c, 16f, 32f, 64f);
                    }
                })
                .launch();
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesRendererSupportDemo.main.launch.icons.new Callable<List<Image>> with () -> {Color c=new Color(TangoColorScheme.DARK_SKY_BLUE); in method public main(args String[]) : void from class ec.util.chart.swing.JTimeSeriesRendererSupportDemo


    private Component createToolBar() {
        JToolBar result = new JToolBar();
        result.setFloatable(false);

        result.add(RANDOM_DATA.toAction(chart)).setIcon(FontAwesome.FA_RANDOM.getIcon(getForeground(), 16f));

        JComboBox<RendererType> types = new JComboBox<>(support.getSupportedRendererTypes().toArray(new RendererType[0]));
        types.setMaximumSize(new Dimension(150, 100));
        types.addItemListener(evt -> {
            RendererType type = (RendererType) evt.getItem();
            chart.getXYPlot().setRenderer(support.createRenderer(type));
            chart.getXYPlot().setBackgroundPaint(support.getPlotColor());
            chart.setBackgroundPaint(colorSchemeSupport.getBackColor());
        });
        types.setSelectedIndex(1);
        result.add(types);

        return result;
    }

    private Component createToolBar() {
        JToolBar result = new JToolBar();
        result.setFloatable(false);

        result.add(RANDOM_DATA.toAction(chart)).setIcon(FontAwesome.FA_RANDOM.getIcon(getForeground(), 16f));

        JComboBox<RendererType> types = new JComboBox<>(support.getSupportedRendererTypes().toArray(new RendererType[0]));
        types.setMaximumSize(new Dimension(150, 100));
        types.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent e) {
                RendererType type = (RendererType) e.getItem();
                chart.getXYPlot().setRenderer(support.createRenderer(type));
                chart.getXYPlot().setBackgroundPaint(support.getPlotColor());
                chart.setBackgroundPaint(colorSchemeSupport.getBackColor());
            }
        });
        types.setSelectedIndex(1);
        result.add(types);

        return result;
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesRendererSupportDemo.createToolBar.addItemListener.new ItemListener with evt -> {RendererType type=(RendererType)evt.getItem(); in method private createToolBar() : Component from class ec.util.chart.swing.JTimeSeriesRendererSupportDemo


    private Component createSeriesTable(ListSelectionModel seriesSelectionModel) {
        XTable result = new XTable();
        result.setSelectionModel(seriesSelectionModel);
        result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        result.setModel(new SeriesModel(support.seriesInfos));
        ColorCellRenderer r0 = new ColorCellRenderer(FontAwesome.FA_CIRCLE_O);
        result.setDefaultRenderer(Color.class, r0);
        result.setDefaultEditor(Color.class, new ColorCellEditor(colorSchemeSupport, r0));
        ColorCellRenderer r3 = new ColorCellRenderer(FontAwesome.FA_FONT);
        result.getColumnModel().getColumn(3).setCellRenderer(r3);
        result.getColumnModel().getColumn(3).setCellEditor(new ColorCellEditor(colorSchemeSupport, r3));
        result.setDefaultRenderer(Font.class, FontCellRenderer.INSTANCE);
        result.setDefaultEditor(Font.class, new FontCellEditor());
        result.setDefaultRenderer(Stroke.class, StrokeCellRenderer.INSTANCE);
        result.setDefaultEditor(Stroke.class, new StrokeCellEditor());
        result.getModel().addTableModelListener(evt -> chart.fireChartChanged());
        return ModernUI.withEmptyBorders(new JScrollPane(result));
    }

    private Component createSeriesTable(ListSelectionModel seriesSelectionModel) {
        XTable result = new XTable();
        result.setSelectionModel(seriesSelectionModel);
        result.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        result.setModel(new SeriesModel(support.seriesInfos));
        ColorCellRenderer r0 = new ColorCellRenderer(FontAwesome.FA_CIRCLE_O);
        result.setDefaultRenderer(Color.class, r0);
        result.setDefaultEditor(Color.class, new ColorCellEditor(colorSchemeSupport, r0));
        ColorCellRenderer r3 = new ColorCellRenderer(FontAwesome.FA_FONT);
        result.getColumnModel().getColumn(3).setCellRenderer(r3);
        result.getColumnModel().getColumn(3).setCellEditor(new ColorCellEditor(colorSchemeSupport, r3));
        result.setDefaultRenderer(Font.class, FontCellRenderer.INSTANCE);
        result.setDefaultEditor(Font.class, new FontCellEditor());
        result.setDefaultRenderer(Stroke.class, StrokeCellRenderer.INSTANCE);
        result.setDefaultEditor(Stroke.class, new StrokeCellEditor());
        result.getModel().addTableModelListener(new TableModelListener() {
            @Override
            public void tableChanged(TableModelEvent e) {
                chart.fireChartChanged();
            }
        });
        return ModernUI.withEmptyBorders(new JScrollPane(result));
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesRendererSupportDemo.createSeriesTable.addTableModelListener.new TableModelListener with evt -> chart.fireChartChanged() in method private createSeriesTable(seriesSelectionModel ListSelectionModel) : Component from class ec.util.chart.swing.JTimeSeriesRendererSupportDemo


    private Component createObsTable(ListSelectionModel seriesSelectionModel) {
        final XTable result = new XTable();
        ColorCellRenderer renderer = new ColorCellRenderer(FontAwesome.FA_CIRCLE_O);
        result.setDefaultRenderer(Color.class, renderer);
        result.setDefaultEditor(Color.class, new ColorCellEditor(colorSchemeSupport, renderer));
        result.setDefaultRenderer(Font.class, FontCellRenderer.INSTANCE);
        result.setDefaultEditor(Font.class, new FontCellEditor());
        result.setDefaultRenderer(Stroke.class, StrokeCellRenderer.INSTANCE);
        result.setDefaultEditor(Stroke.class, new StrokeCellEditor());
        seriesSelectionModel.addListSelectionListener(evt -> {
            if (!evt.getValueIsAdjusting()) {
                int index = evt.getFirstIndex();
                result.setModel(index != -1 ? new ObsModel(support.seriesInfos[index].obsInfos) : null);
                result.getModel().addTableModelListener(e -> chart.fireChartChanged());
            }
        });
        return ModernUI.withEmptyBorders(new JScrollPane(result));
    }

    private Component createObsTable(ListSelectionModel seriesSelectionModel) {
        final XTable result = new XTable();
        ColorCellRenderer renderer = new ColorCellRenderer(FontAwesome.FA_CIRCLE_O);
        result.setDefaultRenderer(Color.class, renderer);
        result.setDefaultEditor(Color.class, new ColorCellEditor(colorSchemeSupport, renderer));
        result.setDefaultRenderer(Font.class, FontCellRenderer.INSTANCE);
        result.setDefaultEditor(Font.class, new FontCellEditor());
        result.setDefaultRenderer(Stroke.class, StrokeCellRenderer.INSTANCE);
        result.setDefaultEditor(Stroke.class, new StrokeCellEditor());
        seriesSelectionModel.addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    int index = e.getFirstIndex();
                    result.setModel(index != -1 ? new ObsModel(support.seriesInfos[index].obsInfos) : null);
                    result.getModel().addTableModelListener(new TableModelListener() {
                        @Override
                        public void tableChanged(TableModelEvent e) {
                            chart.fireChartChanged();
                        }
                    });
                }
            }
        });
        return ModernUI.withEmptyBorders(new JScrollPane(result));
    }

Replace Anonymous With Lambda ec.util.chart.swing.JTimeSeriesRendererSupportDemo.createObsTable.addListSelectionListener.new ListSelectionListener with evt -> {if(!evt.getValueIsAdjusting()){int index=evt.getFirstIndex(); in method private createObsTable(seriesSelectionModel ListSelectionModel) : Component from class ec.util.chart.swing.JTimeSeriesRendererSupportDemo


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(DesktopDemo.class)
                .title("Desktop Demo")
                .size(520, 400)
                .resizable(false)
                .icons(() -> FontAwesome.FA_DESKTOP.getImages(Color.BLACK, 16f, 32f, 64f))
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(DesktopDemo.class)
                .title("Desktop Demo")
                .size(520, 400)
                .resizable(false)
                .icons(new Callable<List<Image>>() {
                    @Override
                    public List<Image> call() throws Exception {
                        return FontAwesome.FA_DESKTOP.getImages(Color.BLACK, 16f, 32f, 64f);
                    }
                })
                .launch();
    }

Replace Anonymous With Lambda ec.util.desktop.DesktopDemo.main.launch.icons.new Callable<List<Image>> with () -> FontAwesome.FA_DESKTOP.getImages(Color.BLACK,16f,32f,64f) in method public main(args String[]) : void from class ec.util.desktop.DesktopDemo


        public FakeRegistry() {
            this.data = new HashMap<>();
            for (WinRegistry.Root o : WinRegistry.Root.values()) {
                data.put(o, new HashMap<>());
            }
        }

        public FakeRegistry() {
            this.data = new HashMap<>();
            for (WinRegistry.Root o : WinRegistry.Root.values()) {
                data.put(o, new HashMap<String, Map<String, String>>());
            }
        }

Replace Generic With Diamond HashMap<String,Map<String,String>> with HashMap<> in method public FakeRegistry() from class ec.util.desktop.impl.WinDesktopTest.FakeRegistry


        public FakeRegistry putKey(Root root, String key) {
            data.get(root).put(key, new HashMap<>());
            return this;
        }

        public FakeRegistry putKey(Root root, String key) {
            data.get(root).put(key, new HashMap<String, String>());
            return this;
        }

Replace Generic With Diamond HashMap<String,String> with HashMap<> in method public putKey(root Root, key String) : FakeRegistry from class ec.util.desktop.impl.WinDesktopTest.FakeRegistry


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(XTableDemo.class)
                .title("XTable Demo")
                .icons(() -> FontAwesome.FA_TABLE.getImages(Color.BLACK, 16f, 32f, 64f))
                .logLevel(Level.FINE)
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(XTableDemo.class)
                .title("XTable Demo")
                .icons(new Callable<List<? extends Image>>() {
                    @Override
                    public List<? extends Image> call() throws Exception {
                        return FontAwesome.FA_TABLE.getImages(Color.BLACK, 16f, 32f, 64f);
                    }
                })
                .logLevel(Level.FINE)
                .launch();
    }

Replace Anonymous With Lambda ec.util.grid.swing.XTableDemo.main.launch.logLevel.icons.new Callable<List<? extends Image>> with () -> FontAwesome.FA_TABLE.getImages(Color.BLACK,16f,32f,64f) in method public main(args String[]) : void from class ec.util.grid.swing.XTableDemo


    public static void main(String[] args) {
        new BasicSwingLauncher().content(() -> {
            BasicFileViewer result = new BasicFileViewer();
            result.setFileHandler(new TxtFileHandler());
            result.setFailureRenderer(CustomFailureRenderer.INSTANCE);
            return result;
        }).launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher().content(new Callable<Component>() {
            @Override
            public Component call() throws Exception {
                BasicFileViewer result = new BasicFileViewer();
                result.setFileHandler(new TxtFileHandler());
                result.setFailureRenderer(CustomFailureRenderer.INSTANCE);
                return result;
            }
        }).launch();
    }

Replace Anonymous With Lambda ec.util.various.swing.BasicFileViewerDemo.main.launch.content.new Callable<Component> with () -> {BasicFileViewer result=new BasicFileViewer(); in method public main(args String[]) : void from class ec.util.various.swing.BasicFileViewerDemo


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(FontAwesomeDemo.class)
                .title("Font Awesome Demo")
                .size(300, 200)
                .icons(() -> FontAwesome.FA_FONT.getImages(Color.BLUE, 16f, 32f, 64f))
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(FontAwesomeDemo.class)
                .title("Font Awesome Demo")
                .size(300, 200)
                .icons(new Callable<List<Image>>() {
                    @Override
                    public List<Image> call() throws Exception {
                        return FontAwesome.FA_FONT.getImages(Color.BLUE, 16f, 32f, 64f);
                    }
                })
                .launch();
    }

Replace Anonymous With Lambda ec.util.various.swing.FontAwesomeDemo.main.launch.icons.new Callable<List<Image>> with () -> FontAwesome.FA_FONT.getImages(Color.BLUE,16f,32f,64f) in method public main(args String[]) : void from class ec.util.various.swing.FontAwesomeDemo


    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(FontAwesomeDemo2.class)
                .title("Font Awesome Demo 2")
                .size(240, 200)
                .icons(() -> FontAwesome.FA_FONT.getImages(Color.BLUE, 16f, 32f, 64f))
                .resizable(false)
                .launch();
    }

    public static void main(String[] args) {
        new BasicSwingLauncher()
                .content(FontAwesomeDemo2.class)
                .title("Font Awesome Demo 2")
                .size(240, 200)
                .icons(new Callable<List<Image>>() {
                    @Override
                    public List<Image> call() throws Exception {
                        return FontAwesome.FA_FONT.getImages(Color.BLUE, 16f, 32f, 64f);
                    }
                })
                .resizable(false)
                .launch();
    }

Replace Anonymous With Lambda ec.util.various.swing.FontAwesomeDemo2.main.launch.resizable.icons.new Callable<List<Image>> with () -> FontAwesome.FA_FONT.getImages(Color.BLUE,16f,32f,64f) in method public main(args String[]) : void from class ec.util.various.swing.FontAwesomeDemo2


    public static List<String[]> readData(File file, char separator) {
        LOG.info("using input file={}", file.getAbsolutePath());
        List<String[]> myEntries = Lists.newArrayList();

        // see http://opencsv.sourceforge.net/#how-to-read
        try (CSVReader reader = new CSVReader(new FileReader(file), separator)) {
            myEntries = reader.readAll();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return myEntries;
    }

    public static List<String[]> readData(File file, char separator) {
        LOG.info("using input file={}", file.getAbsolutePath());
        List<String[]> myEntries = Lists.newArrayList();

        // see http://opencsv.sourceforge.net/#how-to-read
        CSVReader reader = null;
        try {
            reader = new CSVReader(new FileReader(file), separator);
            myEntries = reader.readAll();
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e) {
                    // ignore
                }
            }
        }
        return myEntries;
    }

Try With Resources try(CSVReader reader=new CSVReader(new FileReader(file),separator)) in method public readData(file File, separator char) : List<String[]> from class org.movsim.io.CsvReaderUtil


    static void exportDOT(DirectedGraph<Long, RoadSegment> graph, String fileName) {
        StringWriter writer = new StringWriter();

        // Vertex attribute provider
        ComponentAttributeProvider<Long> vertexAttributeProvider = new ComponentAttributeProvider<Long>() {
            @Override
            public Map<String, String> getComponentAttributes(Long v) {
                Map<String, String> map = new LinkedHashMap<>();
                map.put("label", "nodeId=" + v.toString());
                return map;
            }
        };

        // Edge attribute provider
        ComponentAttributeProvider<RoadSegment> edgeAttributeProvider = new ComponentAttributeProvider<RoadSegment>() {
            @Override
            public Map<String, String> getComponentAttributes(RoadSegment e) {
                Map<String, String> map = new LinkedHashMap<>();
                map.put("label", "edge=" + e.userId() + ", length=" + e.roadLength() + ", lanes=" + e.laneCount());
                return map;
            }
        };

        DOTExporter<Long, RoadSegment> exporter = new DOTExporter<>(new IntegerNameProvider<Long>(), null, null,
                vertexAttributeProvider, edgeAttributeProvider);
        exporter.export(writer, graph);

        try (FileWriter fileWriter = new FileWriter(new File(fileName))) {
            fileWriter.write(writer.toString());
            fileWriter.flush();
        } catch (IOException e) {
            LOG.error("error while writing", e);
        }
    }

    static void exportDOT(DirectedGraph<Long, RoadSegment> graph, String fileName) {
        StringWriter writer = new StringWriter();

        // Vertex attribute provider
        ComponentAttributeProvider<Long> vertexAttributeProvider = new ComponentAttributeProvider<Long>() {
            @Override
            public Map<String, String> getComponentAttributes(Long v) {
                Map<String, String> map = new LinkedHashMap<>();
                map.put("label", "nodeId=" + v.toString());
                return map;
            }
        };

        // Edge attribute provider
        ComponentAttributeProvider<RoadSegment> edgeAttributeProvider = new ComponentAttributeProvider<RoadSegment>() {
            @Override
            public Map<String, String> getComponentAttributes(RoadSegment e) {
                Map<String, String> map = new LinkedHashMap<>();
                map.put("label", "edge=" + e.userId() + ", length=" + e.roadLength() + ", lanes=" + e.laneCount());
                return map;
            }
        };

        DOTExporter<Long, RoadSegment> exporter = new DOTExporter<>(new IntegerNameProvider<Long>(), null, null,
                vertexAttributeProvider, edgeAttributeProvider);
        exporter.export(writer, graph);

        try {
            FileWriter fileWriter = new FileWriter(new File(fileName));
            fileWriter.write(writer.toString());
            fileWriter.flush();
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

Try With Resources try(FileWriter fileWriter=new FileWriter(new File(fileName))) in method package exportDOT(graph DirectedGraph<Long,RoadSegment>, fileName String) : void from class org.movsim.simulator.roadnetwork.routing.GraphExporter


            @Override
            public void run() {
                String highscoreFilename = ProjectMetaData.getInstance().getProjectName() + "_highscore.txt";
                TreeSet<HighscoreEntry> sortedResults = new TreeSet<>(new Comparator<HighscoreEntry>() {
                    @Override
                    public int compare(HighscoreEntry o1, HighscoreEntry o2) {
                        Double d1 = new Double(o1.getQuantity(Quantity.totalSimulationTime));
                        Double d2 = new Double(o2.getQuantity(Quantity.totalSimulationTime));
                        return d1.compareTo(d2);
                    }
                });
                sortedResults.addAll(readHighscores(highscoreFilename));

                int rank = determineRanking(highscoreEntry, sortedResults);
                JOptionPane.showMessageDialog(null, getDialogMessage(highscoreEntry, sortedResults.size(), rank));

                if (rank <= MAX_RANK_FOR_HIGHSCORE) {
                    // TODO limit input to reasonable number of characters
                    String username = JOptionPane.showInputDialog(null, askingForName, "");
                    highscoreEntry.setPlayerName(username);
                }

                sortedResults.add(highscoreEntry);

                writeFile(highscoreFilename, sortedResults);

                displayHighscores(sortedResults);
            }

            @Override
            public void run() {
                String highscoreFilename = ProjectMetaData.getInstance().getProjectName() + "_highscore.txt";
                TreeSet<HighscoreEntry> sortedResults = new TreeSet<HighscoreEntry>(new Comparator<HighscoreEntry>() {
                    @Override
                    public int compare(HighscoreEntry o1, HighscoreEntry o2) {
                        Double d1 = new Double(o1.getQuantity(Quantity.totalSimulationTime));
                        Double d2 = new Double(o2.getQuantity(Quantity.totalSimulationTime));
                        return d1.compareTo(d2);
                    }
                });
                sortedResults.addAll(readHighscores(highscoreFilename));

                int rank = determineRanking(highscoreEntry, sortedResults);
                JOptionPane.showMessageDialog(null, getDialogMessage(highscoreEntry, sortedResults.size(), rank));

                if (rank <= MAX_RANK_FOR_HIGHSCORE) {
                    // TODO limit input to reasonable number of characters
                    String username = JOptionPane.showInputDialog(null, askingForName, "");
                    highscoreEntry.setPlayerName(username);
                }

                sortedResults.add(highscoreEntry);

                writeFile(highscoreFilename, sortedResults);

                displayHighscores(sortedResults);
            }

Replace Generic With Diamond TreeSet<HighscoreEntry> with TreeSet<> in method public run() : void from class org.movsim.viewer.ui.HighscoreFrame.highscoreForGames.invokeLater.new Runnable