Computer >> jsp >> Can you explain Collection.Sort in java with these program ?

Can you explain Collection.Sort in java with these program ?

Dear friends,

I have written a program which sorts the ArrayList < String >

variable Strings Collection.sort(Strings).

I think it sorts by ascii values of A and a.

import java.util.*;

public class LetterASort {

public static void main(String[] args) {

ArrayList<String> Strings = new ArrayList<String>();

Strings.add("aAaA");

Strings.add("AaA");

Strings.add("aAa");

Strings.add("AAaa");

Collections.sort(Strings);

for(String s: Strings) { System.out.print(s+ " "); }

}

}

output :

D:\>javac LetterASort.java

D:\>java LetterASort

AAaa AaA aAa aAaA

Can you explain Collection.Sort in java with these program ?

Yes the sort operation on collections sorts by default as case sensitive, and places higher precidence on upper case characters, it is possible it does this based on the ascii table as upper case letters in the ascii table are in the 100's somewhere and lowercase letters are in the 60's.

if your not happy with the sort there are a few specifiers you can place after the Strings collection, ie for non case sensitive sort you can write Collections.sort(Strings, String.CASE_INSENSITIVE_ORDER);

Can you explain Collection.Sort in java with these program ?

i could try this out on my comp and tell you the answer would that help ( i have Java SOFTWARE) but i cant tell you if your right until i try

C++......................?
is there a less complicated c++ compiler than microsoft express 2008? i found it to complicated and hav found no other free program to make a fps. a t..
C++???????
I am trying to make a tic tac toe game for c++ but i dont know how to use an array to make the board. also after i make the board hiw do i code it so ..
C++???????????????
I HAVE NO IDEA WHAT C++ IS? and i have an exam tomorrow. I dont understand 1. character set 2.tokens. i also have the for statement program, if stat..
C++..........................?
where i find the best c++ programing books.C++..........................?AT www.esnips.com/C++..........................?Try doing a search. OReilly t..
C++????????
i need to know a simple program to concat two strings without using strcat inside operator overloading.plz help me with a program..............C++????..
...................c++?
How would I create a program that that displays the sum of a sales amount in each of 4 regions, during a 3 month period, which would also display the ..
"Smitfraud-C. Toolbar888&..
I am a webmaster, and I am trying to build my website, but my computer keeps acting weird and seems to be going into random hybernation for no reason ..
C programme...?
I wrote a programme of calculator in C language. And it has two or three error so pl do correct them. And send me correct answer. Prog. is: #includest..
C programme...?
I wrote a programme of calculator in C language. And it has two or three error so pl do correct them. And send me correct answer. Prog. is: #includest..
C programme...?
I wrote a programme of calculator in C language. And it has two or three error so pl do correct them. And send me correct answer. Prog. is: #includest..
data computer viruses trojans
1 2 3 4 5 6 skin care 7 8 9 10 11 12 13 14 15 16 17 18 web hosting 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 pets 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100