Salut,

j'aimerais parcourir les jours d'un Calendrier à partir de la date actuelle jusqu'a cette date plus sept jour, c'est à dire si nous sommes Mercredi par exemple, j'aimerai parcouri toutes les dates jusqu'a Mercredi de la semaine suivante. J'ai trouveé ceci sur le net
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Iterator;
 
/**
 * kudos: http://helpdesk.objects.com.au/java/how-can-i-iterate-through-all-dates-in-a-range
 * @date   Jan 12, 2010
 */
public class DateIterator implements Iterator<Date>, Iterable<Date> {
	 private Calendar end = Calendar.getInstance();
	    private Calendar current = Calendar.getInstance();
 
	    public DateIterator(Date start, Date end)
	    {
	        this.end.setTime(end);
	        this.end.add(Calendar.DATE, -1);
	        this.current.setTime(start);
	        this.current.add(Calendar.DATE, -1);
	    }
 
	    public boolean hasNext()
	    {
	        return !current.after(end);
	    }
 
	    public Date next()
	    {
	        current.add(Calendar.DATE, 1);
	        return current.getTime();
	    }
 
	    public void remove()
	    {
	        throw new UnsupportedOperationException(
	           "Cannot remove");
	    }
 
	    public Iterator<Date> iterator()
	    {
	        return this;
	    }
 
	    public static void main(String[] args)
	    {
	    	//Map<String, String>  mapValues = theform.getColumn();
 
	    	//String newColumnValues[] = new ArrayList<String>(mapValues.values()).toArray(new String[0]);
 
	    	Date d1 = new Date();
	    	Calendar cal = Calendar.getInstance();
	    	cal.add(Calendar.DATE, 20);
	    	Date d2 = cal.getTime();
 
	    	Iterator<Date> i = new DateIterator(d1, d2);
	    	while(i.hasNext())
	    	{
	    		Date date = i.next();
	    		System.out.println(date);
	    	}
	    }
 
}
Il ne correspond pas exactement a ce que je veux.

Merci