我有两个列表,我想要过滤器thoose元素,这两个元素都列表包含.我想用lambda表达式来做这件事.
用户getName和客户端getUserName都返回String.
这是我的示例代码:
List<Client> clients = new ArrayList<>();
List<User> users = new ArrayList<>();
List<Client> results = new ArrayList<>();
for (Client user : users) {
for(Client client: clients){
if(user.getName().equals(client.getUserName())){
result.add(client);
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在开发netbeans中的JavaFx应用程序,在netbeans中项目正在构建并运行良好.
我从我的项目中创建了一个构建(mvn包),它完成没有错误,但是当我启动程序时,它没有加载所有场景,并且在这种情况下FXMLLoader返回null值.
所有.fxml文件位于同一文件夹中.
public class JavaFXApplication extends Application {
public static final String TOOLBAR_MAIN = "toolbarMain";
public static final String TOOLBAR_MAIN_FXML = "/fxml/ToolbarMain.fxml";
public static final String TOOLBAR_SUB = "toolbarSub";
public static final String TOOLBAR_SUB_FXML = "/fxml/ToolbarSub.fxml";
public static final String NEW_SESSION_PANEL = "newSession";
public static final String NEW_SESSION_PANEL_FXML = "/fxml/NewSessionPanel.fxml";
public static final String OPEN_SESSION_PANEL = "openSession";
public static final String OPEN_SESSION_PANEL_FXML = "/fxml/OpenSessionPanel.fxml";
public static final String CONNECTIONS_PANEL = "connections";
public static final String CONNECTIONS_PANEL_FXML = "/fxml/ConnectionsPanel.fxml";
public …Run Code Online (Sandbox Code Playgroud) 我想获取指定子模块的当前提交ID.我想当我进入子模块目录并运行git rev-parse HEAD后,我发现这是一个超级项目当前ID.git submodule status | grep <submodule_name>也试过,但它对我来说很慢.知道如何更快地获取这些信息吗?
我第一次使用JavaFx,遇到了事件问题.我使用SceneBuilder构建了一个表单,并在.fxml和controller上添加了一个事件,但它始终返回:
Exception in thread "JavaFX Application Thread" java.lang.IllegalArgumentException: argument type mismatch
Run Code Online (Sandbox Code Playgroud)
FirstScene.fxml:
<AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" styleClass="background" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="examlog.gui.FirstSceneController">
<stylesheets>
<URL value="@dark_style.css" />
</stylesheets>
<children>
<TableView fx:id="firstScene_tableView" layoutX="30.0" layoutY="42.0" prefHeight="287.0" prefWidth="600.0" AnchorPane.bottomAnchor="71.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="42.0">
<columns>
<TableColumn text="C1" />
<TableColumn prefWidth="70.0" text="C2" />
</columns>
</TableView>
<Label layoutX="14.0" layoutY="14.0" text="Létrehozott munkafolyamatok:" />
<Button fx:id="firstScene_newbutton" layoutX="522.0" layoutY="353.0" mnemonicParsing="false" onMouseClicked="#newButtonClick" text="ÚJ" />
</children>
</AnchorPane>
Run Code Online (Sandbox Code Playgroud)
FirstSceneController.java:
public class FirstSceneController implements Initializable {
@FXML
private Button firstScene_newbutton;
@FXML
private TableView firstScene_tableView;
/**
* Initializes …Run Code Online (Sandbox Code Playgroud) 我想org.hibernate:hibernate-gradle-plugin在我的项目中使用插件 dsl 样式。这是我的build.gradle.kts插件部分:
plugins {
kotlin("jvm") version "1.3.31"
id("io.spring.dependency-management") version "1.0.6.RELEASE"
id("org.springframework.boot") version "2.1.5.RELEASE"
id("org.jetbrains.kotlin.plugin.spring") version "1.3.31"
id("org.jetbrains.kotlin.plugin.jpa") version "1.3.31"
}
Run Code Online (Sandbox Code Playgroud)
有谁知道如何做到这一点?
所有文档和帖子都使用旧插件应用程序。像这样:如何为字节码增强设置 Hibernate Gradle 插件?
我有一个列表,其中包含一些连接的值.我需要使用列表中的键和值创建一个hashmap并合并在一起.但我真的不知道该怎么做.
输入:
my @in =(
'mgenv/1_2_3/parent.dx_environment',
'mgenv/1_2_3/doc/types.dat');
Run Code Online (Sandbox Code Playgroud)
预期产量:
"{ $env => { $ver => [ $file1, $file2, ... ] } }"
Run Code Online (Sandbox Code Playgroud)
我试过这些:
(1)
my @sack_files = (
'mgenv/1_2_3/parent.dx_environment',
'mgenv/1_2_3/doc/types.dat');
my $sack_tree = {};
my %hash=();
for( my $i=0; $i<scalar @sack_files; $i++){
my @array = split(/[\/]+/,$sack_files[$i]);
for(my $i=0;$i<(scalar @array)-1;$i++){
my $first = $array[$i];
my $second = $array[$i+1];
$hash{$first}=$second;
}
# merge
}
Run Code Online (Sandbox Code Playgroud)
(2)
use Data::Dumper;
my @sack_files = (
'mgenv/1_2_3/parent.dx_environment',
'mgenv/1_2_3/doc/types.dat',
);
my $sack_tree = {};
my %hash=();
for( my $i=0; …Run Code Online (Sandbox Code Playgroud) 我有一个jenkins master和一个单独的slave服务器.我使用swarm插件将slave连接到master.在配置LDAP认证并撤消匿名用户授权之前,一切正常.
显然现在我必须验证swarm客户端,但我无法做到这一点.如果有人有swarm插件的经验,请告诉我.
从机的控制台:
$ java -jar swarm-client-2-0.jar -master http://x.x.x.x:8080/ -username 'exxxx' -password common.pwd
Discovering Jenkins master
Oct 01, 2015 2:14:51 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: basic authentication scheme selected
Oct 01, 2015 2:14:51 PM org.apache.commons.httpclient.HttpMethodDirector processWWWAuthChallenge
INFO: Failure authenticating with BASIC 'Jenkins'@x.x.x.x:8080
Failed to fetch slave info from Jenkins CODE: 401
Retrying in 10 seconds
Run Code Online (Sandbox Code Playgroud)
BR,
我想在 Spring Boot 中使用嵌套的 ConfigurationProperties,它在 java 中有效,但在 kotlin 中无效。我的应用程序属性中有以下几行:
cert.signing-cert.filePath=truststore.jks
cert.signing-cert.password=xxxx
cert.private-signing.filePath=sign_test.p12
cert.private-signing.password=xxxx
cert.private-encrpytion.filePath=encryption_test.p12
cert.private-encrpytion.password=xxx
Run Code Online (Sandbox Code Playgroud)
我创建了这个结构来处理这些属性:
@Component
@ConfigurationProperties("cert")
class CertConfig {
lateinit var signingCert: SigningCert
lateinit var privateSigning: PrivateSigning
lateinit var privateEncrpytion: PrivateEncrpytion
class SigningCert {
lateinit var filePath: String
lateinit var password: String
}
class PrivateSigning {
lateinit var filePath: String
lateinit var password: String
}
class PrivateEncrpytion {
lateinit var filePath: String
lateinit var password: String
}
}
Run Code Online (Sandbox Code Playgroud)
我添加了kapt插件和依赖到我的build.gradle.kts
kotlin("kapt") version "1.3.50"
...
kapt("org.springframework.boot:spring-boot-configuration-processor")
implementation("org.springframework.boot:spring-boot-configuration-processor") …Run Code Online (Sandbox Code Playgroud)