/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
class Pessoa {
private int idade;
public Pessoa
(String nome,
int idade
) { this.nome = nome;
this.idade = idade;
}
return nome;
}
public void setNome
(String nome
) { this.nome = nome;
}
public int getIdade() {
return idade;
}
public void setIdade(int idade) {
this.idade = idade;
}
public String obterInformacoes
(){ return "Nome: " + nome + ", Idade: " + idade;
}
}
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
private static List<Pessoa> listaPessoas = new ArrayList<Pessoa>();
{
listaPessoas.add(new Pessoa("João", 10));
listaPessoas.add(new Pessoa("Filomena", 11));
listaPessoas.add(new Pessoa("Martim", 15));
listaPessoas.add(new Pessoa("Ana", 21));
listaPessoas.add(new Pessoa("Rui", 9));
listaPessoas.sort((p1,p2)->p1.getNome().compareTo(p2.getNome()));
listaPessoas.
forEach(x
->System.
out.
println(x.
obterInformacoes())); }
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBQZXNzb2EgewogICAgcHJpdmF0ZSBTdHJpbmcgbm9tZTsKICAgIHByaXZhdGUgaW50IGlkYWRlOwoKICAgIHB1YmxpYyBQZXNzb2EoU3RyaW5nIG5vbWUsIGludCBpZGFkZSkgewogICAgICAgIHRoaXMubm9tZSA9IG5vbWU7CiAgICAgICAgdGhpcy5pZGFkZSA9IGlkYWRlOwogICAgfQoKICAgIHB1YmxpYyBTdHJpbmcgZ2V0Tm9tZSgpIHsKICAgICAgICByZXR1cm4gbm9tZTsKICAgIH0KCiAgICBwdWJsaWMgdm9pZCBzZXROb21lKFN0cmluZyBub21lKSB7CiAgICAgICAgdGhpcy5ub21lID0gbm9tZTsKICAgIH0KCiAgICBwdWJsaWMgaW50IGdldElkYWRlKCkgewogICAgICAgIHJldHVybiBpZ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