Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sorting of string elements in alphabetical order

 
lmahesh kumar
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am having an string array of some size.
\
I want to sort in alphabetical order .

Pls give me the logic or simple example .



ThankS.
Mahesh L.
=========
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Collections.sort(Arrays.asList(yourArray));
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or Arrays.sort(array). There's a version that takes a Comparator if you need to do case-insensitive sorting: Arrays.sort(array, String.CASE_INSENSITIVE_ORDER).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic