if u wanted to sort string in a ridiculous way such as placing the rule
a - z comes before A - Z
example Aab , aAb
ordering would result in aAb then Aab
obviously you can hard code this. but i'm looking for something more of a shortcut
anything that lets me state or modified small change that will allow me to do this
have read comparable interface, Collection, comparator
looking for general method that allows u to state rules for sorting and it will sort
If you've read about the Comparator interface, then you know that it is the way to specify your "rules for sorting".
Perhaps you could say more precisely what you are trying to do.
gcalvin is quite right about Comparator being the "general method that allows [yo]u to state rules for sorting". Particular implementations of Comparator might be appropriate for the specific sorts you have in mind.
For example the example you gave looks like a lexical sort: where you examine the elements of a pair of sequences in turn and when you first discover a difference, use that to determine the ordering of the sequences. The "rule" for such a Comparator could be as simple as an array specifying the ordering you want individual characters to have. Setting the array would give your Comparator the precise behaviour you wanted.
A more elaborate example of a Comparator whose behaviour is specified by rules (specifically designed for locale sensitive sorting of strings) is RuleBasedCollator. The example you gave would be specified with rules that give the "tertiary" or case distinction, so called because it is typically applied after letter or accent difference. Don't know if this qualifies as a "shortcut" though...
Yes, actually pbrockway2's answer was quite helpful, while mine was kind of snide and unhelpful. Sorry about that.
Actually your reply was what I was going to post some time ago! I mean the OP asked for the general method and that's ... a Comparator. I don't think it's snide to point that out.
I know it's difficult for people to decide how precisely they should describe a problem, but it's a pity there hasn't been a response to my suggestion that a little more detail would be helpful here. This being Java it's a fair bet that the answer will be a Comparator: but how do you implement it? For that it would be good to know more about how it's going to be used.