草庐IT

same_params

全部标签

java - eclipse : XML document structures must start and end within the same entity 中的 SaxParseException

我正在使用JAVA的last.fmAPI,可以找到here.我有一个巨大的Dataset其中我只使用包含用户艺术家历史和播放的文件。我用Java编写了一段代码,它提取这些艺术家姓名并根据Artist.getSimilar()方法返回相似的艺术家。我运行了一次,但不是为所有艺术家运行的。我中途终止了调试。然而下一次,我的结果从缓存中返回,请求不再发送到网络服务器。问题是,这次我只得到结果,直到我终止结果的艺术家。我尝试对artists=Artist.getTopAlbums()使用另一种方法,我中途终止并在下次遇到同样的问题。我得到的错误是:[FatalError]:513:9:XMLd

java - 同步 : Threads execute two critical sections in same order

我有以下类型的代码:synchronizedblock1{//onlyonethreadintheblock}{lotofcodewheresynchronizationnotnecessary}synchronizedblock2{//onlyonethreadintheblock.//Allthethreadsthatexecutedblock1beforethisthreadshouldhavealreadyexecutedthisblock.}每个线程首先以相同的顺序执行block1、非同步块(synchronizedblock)和block2。如果线程T1在线程T2之前执行b

java - 名称冲突 : The method add(Object) of type test2 has the same erasure as add(E) of type HashSet<E> but does not override it

导入java.util.*;classAextendsHashSet{publicbooleanadd(Objectobj){//compilererrorreturntrue;}}orclassAbc{publicvoidadd(Tt){}//compilererrorpublicvoidadd(Objecti){}//compilererror(can'toverload?)}错误:名称冲突:test2类型的方法add(Object)与HashSet类型的add(E)具有相同的删除,但没有覆盖它我不知道上述错误背后的概念是什么,有人可以建议我在哪里可以研究这个概念吗?

Java Bean 验证 : How do I specify multiple validation constraints of the same type but with different groups?

我有多个进程,其中bean属性必须具有不同的值。示例:@Min(value=0,groups=ProcessA.class)@Min(value=20,groups=ProcessB.class)privateinttemperature;不幸的是bean验证JSR303没有设置@Repeatable在javax.validation.constraints.Min上,所以这种方法不起作用。我找到了“Min.List”,但没有任何关于如何使用它的文档。相反,官方Oracle文档声明在http://docs.oracle.com/javaee/7/api/javax/validation

java - JUnit5 中缺少 org.junit.jupiter.params

我正在尝试将参数化测试添加到我的Java程序中。我找到了JUnit5的示例,我确实已经包含了这些示例。https://blog.codefx.org/libraries/junit-5-parameterized-tests/问题是我无法添加@ParameterizedTest,因为缺少命名空间。不知道为什么或如何。documentation页面明确指出它在org.junit.jupiter.params中,但我没有。让您了解我的代码:importorg.junit.jupiter.api.Test;importjava.util.Arrays;importjava.util.Coll

java - Sonar : "Module is already part of project" or How to upload projects with same dependencies?

我有两个项目(A和B),它们使用相同的可重用模块(C)。我将A上传到sonarqube没有问题,但是当我上传B时,sonar-maven-plugin告诉我模块C已经是项目A的一部分。我该如何修复它?我希望我的两个项目都上传到sonarqube。 最佳答案 如果您是Sonar管理员,请转到http:///background_tasks并选择执行日志。您有以下错误:2016.11.1808:56:08ERROR[o.s.s.c.t.CeWorkerCallableImpl]FailedtoexecutetaskXXXXXXorg.s

Java实践: returning same object which was passed as parameter

在下面的代码中,updateWithContex返回它作为参数的同一个对象真的是不好的做法吗?classSomeClass{FooupdateWithContex(Foofoo){foo.setAppId(i);foo.setXId(index);//.....returnfoo;}}classFoo{publicvoidsetAppId(intappId){//}publicvoidsetXId(intappId){//}publicvoidchangeState(Xx){//}}在C++中,我见过这样的代码:BigObject&fastTransform(BigObject&myB

java - 'mix class and interfaces in the same package' 是不好的做法吗?

我刚刚发现了一些我以前从未听说过并且我不同意(到现在)的东西。在(已投票且未进一步评论)answer我阅读了“为什么要在同一个包中混合类和接口(interface)”所以我想知道,是否有理由将Java中的接口(interface)和实现分开。我知道我们没有义务将所有实现都放在接口(interface)包中,但(有时)不在那里是明智的吗?问候迈克[;-) 最佳答案 我同意org.life.java-我将拥有服务和底层service.impl包,但始终采用那种安排。我不同意“不好的做法”这个词。太强了。java.utilCollecti

java - hibernate 异常 : Found two representations of same collection

如果我保存一个包含以下列表的对象@OneToMany(cascade=CascadeType.ALL,mappedBy="taskList")@OrderColumn(name="position",nullable=false)publicListtasks=newArrayList();我得到异常org.hibernate.HibernateException:FoundtworepresentationsofsamecollectionPlay!中的代码Controller看起来像这样:TaskListtaskList=taskList.findById(taskListId);

Java 9 : Possible to have 2 modules with same name on module path

是否可以在模块路径上有2个名称完全相同(但内容略有不同)的模块?据我所知,Java9编译器并没有提示它。我有2个模块声明如下:modulecom.dj.helper{exportscom.dj.helper;}两者都包含com.dj.helper包,但包内的内容不同。然后在我的主应用程序中,我希望导入此模块:modulecom.dj{requirescom.dj.helper;}同名的两个模块都在我的模块路径上。我希望在编译我的com.dj模块时,编译器会提示同一模块存在两次,但事实并非如此。这是否实际上意味着您的模块路径上可能有同一个jar的2个版本,而Java不知道要使用哪一个?