Para ter um método bubbleSort que ordene Strings como seria?
No código abaixo é para ordenar números!
Como eu faria isso com String?
public class Ordenacao {
private int[] vetor;
public int[] getVetor() {
return vetor;
}
public void setVetor(int[] vetor) {
this.vetor = vetor;
}
public void bubbleSort() {
int tamanho = vetor.length;
for (int i = 0; i < tamanho - 1; i++) {
for (int j = 0; j < tamanho - 1 - i; j++) {
if (vetor[j] > vetor[j + 1]) {
int auxiliar = vetor[j];
vetor[j] = vetor[j + 1];
vetor[j + 1] = auxiliar;
}
}
}
}