Quantcast
Channel: How do I sort an ArrayList of objects the way that I want - Stack Overflow
Browsing latest articles
Browse All 5 View Live

Answer by nagendra547 for How do I sort an ArrayList of objects the way that...

This is very intelligent way of solving the problem.No need to write all the big logic. Just create an arraylist of sorted region. Now the great thing about arraylist is elements are indexed and all...

View Article



Answer by Jose Martinez for How do I sort an ArrayList of objects the way...

Because you would like a very specific ordering that may not be suited for other uses of this Region class, my recommendation is to use a Comparator. Below is a quick draft of what one may look like...

View Article

Answer by Pavan for How do I sort an ArrayList of objects the way that I want

You can check stream feature of java there you can sorted your list of object by based on any variable of your class

View Article

Answer by Sean Patrick Floyd for How do I sort an ArrayList of objects the...

It would be a lot easier if, instead of String, you would use a custom Object, e.g. a class called Region (properties: name and sort index). Then you could implement Comparable and sort it with...

View Article

How do I sort an ArrayList of objects the way that I want

I want to sort an ArrayList Objects the way that I want. Thist is my object: public class PaintRegion extends JPanel { public ArrayList<Region> m_region = new ArrayList<Region>(); // some...

View Article

Browsing latest articles
Browse All 5 View Live




Latest Images