Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

change values in array list

807603Jan 30 2008 — edited Jan 31 2008
I have this arrayList, with these values:

2007-6-15
2006-6-15
2005-6-15

My problem: We deal with Ingres. Ingres dates have months 1-12. Java months are 0-11. To get things to work between the two, I have to add and subtract a month to get them to represent the same dates.

These dates actually should represent 2007-JULY-15, not 2007-JUNE-15, which is how it looks.

Do you know how to cut the arrayList up, change the month string to an int so I can add one and put it back together so I can tick through it with the iterator. I've been trying many different things, but nothing seems to work.

ArrayList datesList = DAO.findPtoDatesList(request.getRemoteUser().toString());

ArrayList showYearList = new ArrayList();
List temp1 = new ArrayList();
List temp2 = new ArrayList();
List temp3 = new ArrayList();

for (int i = 0; i < historyDatesList.size(); i++){

temp1 = historyDatesList.subList(0,historyDatesList.indexOf("-"));
System.out.println("temp1="+temp1);

**it chokes right there - doesn't return my temp1, let alone try parsing anything..

showYearList.add(temp1+"-"+temp2+"-"+temp3);
}

Any suggestions would be wonderful.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2008
Added on Jan 30 2008
10 comments
224 views