Skip to main content
gamedev.net
🔒 Locked

sorting in java

Started by tokenblackguy Mar 20, 2005 at 3:17 PM 3 replies 600+ views
Original Post
tokenblackguy
tokenblackguy
I'm making a card game and have an object called Deck, which holds an array of objects called cards. I need to sort them according to different parameters (ie attack, name, level, etc). I was wondering if it would be better to sort cards within the deck using java's built in sort method, or to code a sort method on my own. It might also help to know what type of sort the java method uses. -Token
joanusdmentia
joanusdmentia
Have you *tried* using the provided sort method? Is it fast enough for your needs? If so, why re-invent the wheel?
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The nly verdict is vengeance; a vendett o
tokenblackguy
tokenblackguy
I guess I am going to have to reinvent the wheel. The documentation that blu pointed me to showed me that sorting methods in java are too limited.
Trap
Trap
I can't see how you come to this conclusion, with custom comperators you can make it sort the cards in any order you want.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.