Here you can find the source of getWeekAbscissa(Class
public static <T> Map<Date, T> getWeekAbscissa(Class<T> cls)
//package com.java2s; import java.util.*; public class Main { public static <T> Map<Date, T> getWeekAbscissa(Class<T> cls) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); Date end = calendar.getTime(); calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); Date start = calendar.getTime(); Map<Date, T> week = new TreeMap<>(); while (start.getTime() <= end.getTime()) { start = new Date(start.getTime() / 1000 * 1000); if (Integer.class.equals(cls)) { week.put(start, (T) (Integer) 0); }/* www .j a v a2s .co m*/ if (Float.class.equals(cls)) { week.put(start, (T) (Float) 0.0f); } if (Double.class.equals(cls)) { week.put(start, (T) (Double) 0.0); } calendar.add(Calendar.DAY_OF_YEAR, 1); start = calendar.getTime(); } return week; } }