How to sort an ArrayList of object depending on a field object

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • momotaro
    Contributor
    • Sep 2006
    • 357

    How to sort an ArrayList of object depending on a field object

    Hi,

    having this class:
    Code:
    public class Field {
    	
    	private boolean isPersisted = true;
    	private String name;
    	private String type;
    	private String elements;
    ...
    	}
    I have constructed an ArrayList of Field then I want to put objects with isPersisted set to false to the tail of my list

    thank's in advance.
  • momotaro
    Contributor
    • Sep 2006
    • 357

    #2
    would be great if you show me how to use treeSets

    Comment

    • Dheeraj Joshi
      Recognized Expert Top Contributor
      • Jul 2009
      • 1129

      #3
      You can use Comparator available in Java.
      Create a comparator class for field object and try comparing.

      Regards
      Dheeraj Joshi

      Comment

      Working...