我需要創建從地圖在Groovy一個數組的字符串。在groovy中追加字符串的理想方式是什麼?
必需的字符串= ^(123|456|789)
目前我在做類似下面,將這項事業的性能問題在生產中框或我應該用StringBuffer的Java類?
def getProjectList(def caseResult) {
def projectList = ""
caseResult.each { projno ->
if (projectList.length() == 0) {
projectList = "^(${projno.project_no}|"
} else {
if (projectList.indexOf(projno.project_no) == -1)
projectList+="${projno.project_no}|"
}
}
projectList = projectList.substring(0, projectList.length() - 1)
projectList += ')'
return projectList
}
'這會引起性能問題'好吧,先定義_performance issue_。 –
你輸入什麼_「地圖陣列」_看起來像什麼? –
@EelLee:OOM異常 – Ricky