Java List Intersect intersectDate(List oDate, List tDate)

Here you can find the source of intersectDate(List oDate, List tDate)

Description

intersect Date

License

Open Source License

Declaration

public static List<Date> intersectDate(List<Date> oDate, List<Date> tDate) 

Method Source Code

//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;
    }
}

Related

  1. intersect(List... lists)
  2. intersect(List in1, List in2)
  3. intersect(Set a, List b)
  4. intersect2orderedList(List s1, List s2)
  5. intersectAll(final List collector, final T[] a, final T[] b)
  6. intersection(final List list1, final List list2)
  7. intersection(final List list1, final List list2)
  8. intersection(final List list1, final List list2)
  9. intersection(List> sets)