| Author |
Need help with collection
|
jay lai
Ranch Hand
Joined: Apr 04, 2002
Posts: 180
|
|
I have a Collection<Box> , I need to extract certain row from this collection base on some criteria. If number, name are the same, using the most recent statusDate (Date)
Ex:
Sincerely thanks and please help!!!
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5798
|
|
Your fist step is to figure out how you would do it "manually." What information do you need to keep track of? What operations do you need to perform? What decisions do you make? Describe the steps as precisely, thoroughly, and simply as possible, without regard to Java or computers--just as a general set of instructions. Once you have that, if you've done it correctly, translating it to Java will be relatively easy.
|
 |
jay lai
Ranch Hand
Joined: Apr 04, 2002
Posts: 180
|
|
Your fist step is to figure out how you would do it "manually." What information do you need to keep track of? What operations do you need to perform? What decisions do you make? Describe the steps as precisely, thoroughly, and simply as possible, without regard to Java or computers--just as a general set of instructions. Once you have that, if you've done it correctly, translating it to Java will be relatively easy.
Yes, I tried to, but still need some help....
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5798
|
|
jay lai wrote:
Your fist step is to figure out how you would do it "manually." What information do you need to keep track of? What operations do you need to perform? What decisions do you make? Describe the steps as precisely, thoroughly, and simply as possible, without regard to Java or computers--just as a general set of instructions. Once you have that, if you've done it correctly, translating it to Java will be relatively easy.
Yes, I tried to, but still need some help....
I can't help you unless you show some effort and ask a more detailed question. What did you try? Where did you get stuck?
|
 |
jay lai
Ranch Hand
Joined: Apr 04, 2002
Posts: 180
|
|
|
|
 |
R. Jain
Ranch Hand
Joined: Aug 11, 2012
Posts: 276
|
|
|
Only keep your codes inside your CodeTags for better readability..
|
OCPJP
|
 |
PrasannaKumar maddu
Greenhorn
Joined: Sep 19, 2012
Posts: 3
|
|
|
By overriding Comparator OR Comparable interfaces methods you can achieve sorting your collection.Google the interfaces.
|
 |
jay lai
Ranch Hand
Joined: Apr 04, 2002
Posts: 180
|
|
PrasannaKumar maddu wrote:By overriding Comparator OR Comparable interfaces methods you can achieve sorting your collection.Google the interfaces.
The collection already sorted. The problem is I have the code above tryign to extract out 1 record of each name, number if they are similar
|
 |
K Abhijit
Ranch Hand
Joined: Mar 03, 2008
Posts: 88
|
|
there are multiple way you can handle this issue.
[MODERATOR ACTION: Deleted fully coded solution.]
K Abhijit, please remember that this site is NotACodeMill, and LetThemDoTheirOwnHomework. Thank you!
|
“The difference between 'involvement' and 'commitment' is like an eggs-and-ham breakfast: the chicken was 'involved' - the pig was 'committed'.”
|
 |
jay lai
Ranch Hand
Joined: Apr 04, 2002
Posts: 180
|
|
K Abhijit wrote:there are multiple way you can handle this issue.
[MODERATOR ACTION: Deleted fully coded solution.]
K Abhijit, please remember that this site is NotACodeMill, and LetThemDoTheirOwnHomework. Thank you!
This site used to be a good, and construtive forum back there., that where people got stuck and ask for it. It is getting worse now!!!
|
 |
 |
|
|
subject: Need help with collection
|
|
|