sort names alphabetically - Java

sortNames

Snippet Code


  
Rate this page :
  [ 0 votes]

To sort a list of names alphabetically.

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);

Tags


Ask Questions

Ask Question