public Memento getClosestDate(SimpleDateTime date) {
		
		int i = 0;
		while (i < size() && get(i).getDateTime().compareTo(date) < 0) 
    		i++;
		
		if (size() == 0)
			return null;
		else if (i == size())
			return getLast();
		else if (i == 0 || get(i).getDateTime().compareTo(date) == 0)
			return get(i);
		else {
			// See if date is closer to i or i-1
			Date newerDate = get(i).getDateTime().getDate();
			Date olderDate = get(i-1).getDateTime().getDate();
						
			int diffInDays1 = (int)Math.round((newerDate.getTime() - date.getDate().getTime()) 
	                 / (1000 * 60 * 60 * 24));			
			
			int diffInDays2 = (int)Math.round((date.getDate().getTime() - olderDate.getTime()) 
	                 / (1000 * 60 * 60 * 24));			
			
			if (diffInDays1 < diffInDays2)
				return get(i);
			else
				return get(i-1);
		}			
	}