小编hat*_*ack的帖子

返回两个Arraylists或使用两种不同的方法

如果我有方法

 public ArrayList<String> necessaryChanges(Set<Object> setToCheck ) {

 //checks to see whether each element of set is correct by comparing it to something
 // and if it needs to be changed its added to an arraylist to be returned to the user

     }
Run Code Online (Sandbox Code Playgroud)

我需要返回一个包含必要更改的列表,这很好.

但我也想修改setToCheck的变化.我知道你不能在一个方法中返回两个对象.我要问的是这样做最有效的方法是什么.

我知道我可以在主类中创建另一个方法并调用它来更改集合,但它似乎效率很低.

有没有更好的方法来做到这一点.

谢谢

java performance arraylist set

0
推荐指数
1
解决办法
994
查看次数

Linux而不是Windows?Java摇摆

所以我在Linux中编写了这个程序,当我创建一个jar并运行它时,它运行得很好.

但出于某种原因,当我把这个罐子放在窗户里时,它并没有.

其中一些有效,但当我尝试做一个简单的点击动作事件时,它会崩溃并告诉我

有一个

Exception in thread "AWT-EVentQueue-0" java.lang.NoClassDefFoundError: miginfocom/layout/cc
Run Code Online (Sandbox Code Playgroud)

好吧无论如何我摆脱了它的某些组件,它的工作原理,但与它们不相干.

// MigLayout layout = new MigLayout("fillx");
            JPanel content = new JPanel(/*layout*/);

 /*CC componentConstraints = new CC();
            CC c = new CC();
            componentConstraints.alignX("center").spanX();
            c.alignX("center").span();
            c.alignY("bottom").span();*/

            content.add(label/*, componentConstraints*/);
            content.add(label1/*,c*/);

    //  after this I add it to a Jframe etc
Run Code Online (Sandbox Code Playgroud)

那里被注释掉的一切都是它无法在Windows上运行的原因.

但它会在Linux上,我不知道为什么这是......

任何人都可以告诉为什么这是或在哪里找到.这将是非常感谢和有用的未来:)

java linux windows swing noclassdeffounderror

0
推荐指数
1
解决办法
149
查看次数