Understanding Maps and Double Linked Lists in Java
Classified in Computers
Written on in
English with a size of 8.4 KB
Map & Diccionarios
Import Statements
import java.security.InvalidParameterException;
import java.util.*;
RedCarreteras Class
public class RedCarreteras {
private Map<String, Map<String, Integer>> red;
//CONSTRUCTORES
public RedCarreteras() {
red = new HashMap<>();// Nuevo dicc a 0
}
//METODOS
private void validarTramo(String una, String otra, int distancia) {
if (una == null || otra == null || una.equals(otra) || distancia < 1)
throw new InvalidParameterException();
}
public Set<String> ciudades() {
return red.keySet();
}
public int nuevoTramo(String una, String otra, int distancia) {
validarTramo(una, otra, distancia);... Continue reading "Understanding Maps and Double Linked Lists in Java" »