views:

28

answers:

1

I have a webpage which has 10 separate text input spaces. I need to sort (alphabetize) the text from those input spaces (based on the first word from each input). For example, if the boxes were:

cat


dog


apple

They would need to be: apple


cat


dog

I need to do this on the fly. What are some options for doing this? I have experience in both Java and Python if that helps.

Thanks in advance.

+1  A: 

If you put these items into a List<String>, then you can call Collections.sort() on your list. That list instance will then be sorted into the natural order based on the String class.

Noel M