please, help me with sort object with date and name?
Please, i am new for here, and need much your help. Because i need sort a arraylist with object. my object has a date and a name, i need know how make to compare two dates in comparator for sort it.
private String Name=null;
private Date date = null;
somebody can help me, please
use Comparator or goto techfaq360.com/java_interview_questions.jsp?qid=379 for code example
Last edited by satyadas; 06-06-2008 at 07:37 AM.
make the class implement the Comparable interface and create a way in which you are going to order the objects of the class. By name and then break ties by some dateorder? I expect you would want to use the built-in sorting capabilities of objects of the String and Date abstract data types.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL