sort names in reverse order - Java

sortNamesReverse

Snippet Code


  
Rate this page :
  [ 0 votes]

To sort a list of names alphabetically in reverse order.

import java.util.ArrayList; import java.util.Collections; ArrayList<String> names = new ArrayList<String>(); names.add("Stephen"); names.add("Albert"); names.add("Selvin"); Collections.sort(names); Collections.reverse(names);

Tags


Ask Questions

Ask Question