Back to project page SimpleNotes.
The source code is released under:
Apache License
If you think the Android project SimpleNotes listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.moysa.simplenotes.core; /* ww w . j a v a 2 s . c o m*/ import java.text.ParseException; import java.util.Comparator; /** * Created by Sergey Moysa on 15.03.14. */ public class NotesComparator implements Comparator<Note> { private boolean byName; private boolean asc; public NotesComparator(boolean byName, boolean asc) { this.byName = byName; this.asc = asc; } public int compare(Note lhs, Note rhs) { try { int result; if (byName) { result = lhs.getName().compareTo(rhs.getName()); } else { result = lhs.getDateFormat().compareTo(rhs.getDateFormat()); } if (asc) return result; else return 0 - result; } catch (ParseException e) { //TODO catch exception e.printStackTrace(); } return 0; } }