确切地说,我只需要将双倍增加一倍,并希望它是线程安全的.我不想使用互斥锁,因为执行速度会急剧下降.
在Java8的Function.class中,我们有:
default <V> Function<V, R> compose(Function<? super V, ? extends T> before) {
Objects.requireNonNull(before);
return (V v) -> apply(before.apply(v));
}
Run Code Online (Sandbox Code Playgroud)
撰写接受:
Function<? super V, ? extends T> before
Run Code Online (Sandbox Code Playgroud)
而不是:
Function<V, ? extends T> before
Run Code Online (Sandbox Code Playgroud)
是否有任何合理的情况,其中"V"是有限的事实?
我尝试按照以下位置的说明使用 JavaFX:
https://openjfx.io/openjfx-docs/下的“JavaFX 和 IntelliJ”->“非模块化 Maven”
完成步骤 1 和 2(安装和验证)后,我尝试从 IntelliJ 而不是通过 Maven 插件运行一个非常简单的程序。
TraderWindow.java
public class TraderWindow extends Application {
@SneakyThrows
public static void main(String[] args) {
launch(args);
}
@Override
@SneakyThrows
public void start(Stage primaryStage) {
Scene scene = FXMLLoader.load(getClass().getResource("/TraderWindow.fxml"));
primaryStage.setScene(scene);
primaryStage.show();
}
}
Run Code Online (Sandbox Code Playgroud)
交易窗口.fxml
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" …Run Code Online (Sandbox Code Playgroud)