Groovy sorting string asc

Posted by srinath on Stack Overflow See other posts from Stack Overflow or by srinath
Published on 2010-03-30T07:01:23Z Indexed on 2010/03/30 7:03 UTC
Read the original article Hit count: 407

Filed under:
|

How to sort string names in array on ascending order .

I tried sort method but it fails to sort on name basis .

def words = ["orange", "blue", "apple", "violet", "green"]

I need to achieve like this :

["apple", "blue", "green", "orange", "violet" ]

thanks in advance.

© Stack Overflow or respective owner

Related posts about groovy

Related posts about sort