我有一个由Objects填充的ArrayList.
我调用的对象类Article有两个字段;
public class Article {
private int codeArt;
private String desArt;
public Article(int aInt, String string) {
this.desArt = string;
this.codeArt = aInt;
}
public int getCodeArt() {return codeArt; }
public void setCodeArt(int codeArt) {this.codeArt = codeArt;}
public String getDesArt() {return desArt;}
public void setDesArt(String desArt) { this.desArt = desArt;}
}
Run Code Online (Sandbox Code Playgroud)
我想使用该desArt字段过滤我的List ,对于测试我使用了字符串"test".
我使用谷歌的Guava,它允许我过滤ArrayList.
这是我试过的代码:
private List<gestionstock.Article> listArticles = new ArrayList<>();
//Here the I've filled my ArrayList
private List<gestionstock.Article> filteredList filteredList = Lists.newArrayList(Collections2.filter(listArticles, Predicates.containsPattern("test")));
Run Code Online (Sandbox Code Playgroud)
但是这段代码不起作用.
我verifierQteDemandee在我的数据库中创建了一个存储函数,它有一个整数参数numBonIn,它返回一个布尔值.
我想在我的java程序中执行这个函数,我用google搜索它,我所能找到的就是执行一个存储过程,但我假设执行存储函数与执行存储过程相同,这就是代码我尝试过:
CallableStatement cStmt = con.prepareCall("{call verifierQteDemandee(?)}");
cStmt.setInt("numBonIn", 42);
boolean hadResults = cStmt.execute();
if (hadResults) {
ResultSet rs = cStmt.getResultSet();
}
Boolean outputValue = cStmt.getBoolean(outputValue);;
Run Code Online (Sandbox Code Playgroud)
该con变量是ANS实例Connection.
你可以在我的代码中注意到我不知道如何从这行中的存储函数中获取返回值:int outputValue = cStmt.getInt("");.
如果有人知道如何获得返回值的程序,我会很感激.
我已经创建了一个java应用程序netbeans,并且我已经构建它以实现它.jar.
现在当我运行我的.jar应用程序时它没有显示任何内容,我想在我的projet中运行一个表单作为应用程序启动时的默认表单.
在视觉工作室,我过去做如下:
Run Code Online (Sandbox Code Playgroud)In Solution Explorer, right-click the project and choose Properties. The Project property page opens with the Application properties displayed. Choose the form you want as the startup form from the Startup Object drop-down list.
但我不知道如何neatbeans使用java应用程序.
我该怎么做 ?