Created
April 5, 2013 02:36
-
-
Save tonussi/5316165 to your computer and use it in GitHub Desktop.
Fila acorrentada.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Elemento<E> { | |
public Elemento(Elemento<E> elemento, Object object) { | |
} | |
public Elemento<E> getProx() { | |
return null; | |
} | |
public void setProx(Elemento<?> topo) { | |
} | |
public E getValor() { | |
return null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FilaCadeia { | |
Elemento<?> topo; | |
FilaCadeia() { | |
topo = null; | |
} | |
@SuppressWarnings({ "rawtypes", "unchecked" }) | |
void push(Elemento<?> elemento) { | |
Elemento<?> novo = new Elemento(elemento, null); | |
novo.setProx(topo); | |
topo = novo; | |
} | |
Elemento<?> pop() { | |
Elemento<?> aux = (Elemento<?>) topo.getValor(); | |
topo = topo.getProx(); | |
return aux; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment