作者nation6238 (挺)
看板java
标题Re: [问题] 请问如何将code不要写死,不需要重新编쐠…
时间Fri Oct 23 02:05:37 2009
※ 引述《xlk (深深)》之铭言:
: 标题: Re: [问题] 请问如何将code不要写死,不需要重新编쐠…
:
: for (CalendarEventEntry entry : feeds.getEntries()) {
:
: // 日历事件title
: String title = entry.getTitle().getPlainText();
:
: if (titles.contains(title)) {// 看看有没有在List里!
:
: // 计算event花费时间, 许多时间类别内部以long type表示时间绝对值
:
: // 对照title在list里的位置来纪录event的次数与总时数
: int index = titles.indexOf(title);
: // List<String> titles = new ArrayList<String>();
:
: eventCount[index]++;
:
: // 印出event资讯
: System.out.print("事件: " + title);
: }
:
感谢你热心解答
可是不知道为什麽你会想出这方法解决,把code变成活的呢?
利用NetBeans除错专案(中断点)查看 每个 区域变数 值
其中
int index = titles.indexOf(title);
我还是搞不懂indexOf意似
为什麽String会变成int
至於分类title写出来了
String GoogleTitle = entry.getTitle().getPlainText();
if (ListTitles.contains(GoogleTitle)) {// 看看有没有在List
// 对照title在list里的位置来纪录event的次数与总时数
index = ListTitles.indexOf(GoogleTitle);
eventCount[index]++;
ii = ii + 1;
// 印出event资讯
for (int j = -1; j < ListTitles.size(); j++) {
if (index == j) {
System.out.println("第 " + ii + " 次数 第 " +
j + " 类 事件: " + GoogleTitle)
}//if
}//for
}//if
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.137.254.170
1F:推 PsMonkey:什麽「意似」我不知道,想知道就去问香蕉,ㄜ...问 API 10/23 08:07
2F:→ PsMonkey:基於程度(比较值),本篇文章给予「作业文条款」警告 10/23 08:10
3F:推 qrtt1:个别指导请播付费专线 :P 10/23 09:20