小编Joh*_*van的帖子

这是最好的方法吗?有没有更清洁的方法?

此方法按预期工作,但我想知道是否有更好的更干净的方法使用现代Java元素编写它。

    /**  
     * Counts how many strings in a given list are shorter than a given min length  
     * @param strings  
     * @param minLength  
     * @return  
     */  
    public int countShortStrings(List<String> strings, int minLength){  
        int numShort = 0;  
        for (String str : strings) {  
            if (str.length() < minLength) {  
                numShort++;  
            }  
        }  
        return numShort;  
    }  
Run Code Online (Sandbox Code Playgroud)

java refactoring

2
推荐指数
1
解决办法
45
查看次数

错误:app:transformClassesWithDexBuilderForDebug

我在这个包中有一个HillfortStore类:

package org.wit.hillforts.models
Run Code Online (Sandbox Code Playgroud)

在类中混淆了软件包名称(缺少“ s”):

package org.wit.hillforts.model
Run Code Online (Sandbox Code Playgroud)

使用错误的包名称将类导入其他类,它可以正常工作:

import org.wit.hillforts.model.HillfortStore
Run Code Online (Sandbox Code Playgroud)

为了清理问题,我在类及其所有导入的类中修复了名称。现在我得到这个错误。

错误:任务':app:transformClassesWithDexBuilderForDebug'的执行失败。

com.android.build.api.transform.TransformException:java.lang.IllegalStateException:Dex归档文件:仅为.CLASS文件设置.DEX扩展名

android exception kotlin

1
推荐指数
2
解决办法
9185
查看次数

标签 统计

android ×1

exception ×1

java ×1

kotlin ×1

refactoring ×1