繁体   English   中英

速度笛卡尔积函数

[英]Speed cartesian product function

我已经写了这个方法:

public static int myCount = 0;
public static int findOperation( String[] current, int k) {

    if (k == newListCodelist.size()) {
        myCount++;// this is max possible selection
        //
        for (int i = 0; i < k; i++) {
            Log.i("sort", current[i] + " ");
        }
        result.add("\n");
        Log.i("sort", "current count: " + myCount);

    } else {
        List<CodeRegistry> code = newListCodelist.get(k).getStatusMessage() .getCodelists().getCodelist().get(0).getCode(); 
        for (int j = 0; j < newListCodelist.get(k).getStatusMessage()
                .getCodelists().getCodelist().get(0).getCode().size(); j++) {

            current[k] = code.get(j).getId(); 
            findOperation( current, k + 1);
        }
    }
    return 0;
}

该函数正常工作,我需要计算n个集合的所有可能动作。

我的问题是,当此功能用于分析大量数据时。 您对加快实施有任何建议吗?

我正在考虑将数据类型转换为整数类型的String: "getID ()" 我可以使用此功能例如进行转换:

Integer.parseInt ()

但这是行不通的,因为id如此“ My_ID”-“ My_ID_Two”

有什么建议么?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM