private static Date checkSameDate ( final List < VoteDataDto > voteList ) throws ParseException { final Set < String > set = new HashSet <> ( ) ; Date result = null ; for ( final VoteDataDto voteData : voteList ) { final String voteDate = voteData . getVoteDate ( ) ; if ( voteDate != null && voteDate . length ( ) >= YYYY_MM_DD . length ( ) ) { set . add ( voteData . getVoteDate ( ) ) ; } } if ( set . size ( ) == CONTAINS_ONE ) { final String dateString = set . iterator ( ) . next ( ) ; result = new SimpleDateFormat ( YYYY_MM_DD , Locale . ENGLISH ) . parse ( dateString ) ; } return result ; }
Check same date .