Here you can find the source of intersectDate(List
public static List<Date> intersectDate(List<Date> oDate, List<Date> tDate)
//package com.java2s; /*/*from w w w.j a v a2 s.c o m*/ * Copyright 2012-2014 sammyun.com.cn. All rights reserved. * Support: http://www.sammyun.com.cn * License: http://www.sammyun.com.cn/license */ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; public class Main { public static List<Date> intersectDate(List<Date> oDate, List<Date> tDate) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); List<Date> listDate = new ArrayList<Date>(); for (Date wDate : oDate) { for (Date iDate : tDate) { String strWDate = sdf.format(wDate).toString(); String strIDate = sdf.format(iDate).toString(); if (strWDate.equals(strIDate)) { listDate.add(wDate); } } } return listDate; } }