Sorting an array of objects
I'm working on a card game, and I need to sort an array that contains card objects. The array needs to be sorted based on the numerical value of each card in ascending order. I have a method, getValue, that returns the value of the card at the element that the method is called upon.
But, I am unsure of how exactly to sort the data correctly, as I am not too familiar with sorting in Java. Any help would be great.
EDIT: Actually, I just figured it out on my own. I just created a new array that contained just the numerical values of the array of cards. Then I just simply sorted that array of ints, since in this case I only cared about the value of the cards, not the suit.
Last edited by ADAMWD; 11-13-2010 at 04:05 AM..