2
I own a List<ListaUsuarios> and I want to sort it alphabetically by name
My code is like this
User class:
public class Usuario{
   private String nome;
   private String empresa;
   private int    idade;
   private String email;
   public Usuario(String nome, String empresa, int idade, String email){
       this.nome    = nome;
       this.empresa = empresa;
       this.idade   = idade;
       this.email   = email;
   }
   //...GETs E SETs PARA TODAS AS VARIAVEIS GLOBAIS . . .
}
class Listausuario:
public class ListaUsuario{
    private Usuario user;
    private int     codigo;
    private int     nivel;
    private boolean ativo;
    public ListaUsuario(Usuario user, int codigo, int nivel, boolean ativo){
        this.user   = user;
        this.codigo = codigo;
        this.nivel  = nivel;
        this.ativo  = ativo;
    }
   //...GETs e SETs PARA TODAS AS VARIAVEIS GLOBAIS . . .
}
I create my Listin this way:
List<ListaUsuario> = new Arraylist<>();
After that I populate her with N items of the type ListaUsuario
How can I order it in alphabetical order by User name?
There are several examples on the site.
– user28595
Thank you, I’ll study on them!
– CristianCotrena