| Author |
modifying a list collections
|
Mohit Sinha
Ranch Hand
Joined: Nov 29, 2004
Posts: 125
|
|
Hi All,
I have a method which get a generics list collection object as an input.
The collection contains objects of class TestObj { int id; String name; double amt}. As an input parameter the list is available in the ascending order of id (1,2,3....so on)
Now before i delegate this collection further down we have to modify this collection a bit i.e. based on certain condition we have to rotate some elements to the bottom list.
Since this is an adhoc calculation check I did not go for Comparator /Comparable based ordering.
Here is what I do
This reorder of the list is needed down the line in the app flow. My question here is this appropriate way of doing it or can this be handled in a better fashion
Thanks.
|
 |
Jeff Storey
Ranch Hand
Joined: Apr 07, 2007
Posts: 230
|
|
Mohit,
I think sorting your list based on a Comparator is a more straightforward way to do it. It makes it a bit clearer as to what you're trying to do.
Jeff
|
Jeff Storey
Software Developer
[url]http://jeffastorey.blogspot.com[/url]
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9955
|
|
I put code tags around your source - it preserves the indenting and makes it easier to read. Next time you post, just click the button above where you enter your text labeled 'code' and it will pop them in for you, then paste your source between them.
Thanks
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
 |
|
|
subject: modifying a list collections
|
|
|