Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Comparator;
- public class DateCompare implements Comparator<Personagem>{
- public int compare (Personagem one, Personagem two){
- if (one.getYear() != two.getYear()){
- return one.getYear() - two.getYear();
- }
- if (one.getMonth() != two.getMonth()){
- return one.getMonth() - two.getMonth();
- }
- if (one.getDay() != two.getDay()){
- return one.getDay()-two.getDay();
- }
- else{
- return 0 ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement