public class Vetor<T> implements br.com.vector.IVetor<T> {
T[] vetor;
int qntElementos = 0;
public Vetor(int tam) {
vetor = (T[]) new Object[tam];
}
public boolean isEmpty() {
return Tamanho() == 0;
}
@Override
public void Adicionar(T elemento) {
if (Tamanho() == vetor.length) {
System.out.println("Vetor Cheio");
}
for (int i = 0; i < vetor.length; i++) {
if (vetor[i] == null) {
vetor[i] = (T) elemento;
qntElementos++;
break;
}
}
}
public void bubbleShot(){
int aux;
for(int i =0; i < Tamanho() -1; i++){
for(int j=1; j < Tamanho() -1; j++){
if(vetor[j] < vetor[j-1]){
}
}
}
}
Como comparo os dois elementos aqui: if(vetor[j] < vetor[j-1])