Commit e29bfb94 by Antonio Rueda

Creación de mapas usando la implementación TreeMap.

parent e159be9c
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
package es.ujaen.dae.reservahoteles.entidades; package es.ujaen.dae.reservahoteles.entidades;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collections;
import java.util.Map; import java.util.Map;
import java.util.TreeMap;
/** /**
* *
...@@ -39,7 +39,7 @@ public class Hotel { ...@@ -39,7 +39,7 @@ public class Hotel {
this.precioHabSimple = precioHabSimple; this.precioHabSimple = precioHabSimple;
this.precioHabDoble = precioHabDoble; this.precioHabDoble = precioHabDoble;
reservas = Collections.emptySortedMap(); reservas = new TreeMap<>();
} }
public int id() { public int id() {
......
...@@ -6,10 +6,10 @@ import es.ujaen.dae.reservahoteles.entidades.Hotel; ...@@ -6,10 +6,10 @@ import es.ujaen.dae.reservahoteles.entidades.Hotel;
import es.ujaen.dae.reservahoteles.entidades.Reserva; import es.ujaen.dae.reservahoteles.entidades.Reserva;
import es.ujaen.dae.reservahoteles.excepciones.ClienteYaRegistrado; import es.ujaen.dae.reservahoteles.excepciones.ClienteYaRegistrado;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.TreeMap;
/** /**
* *
...@@ -20,8 +20,8 @@ public class ServicioReservas { ...@@ -20,8 +20,8 @@ public class ServicioReservas {
Map<String, Cliente> clientes; Map<String, Cliente> clientes;
public ServicioReservas() { public ServicioReservas() {
hoteles = Collections.emptyMap(); hoteles = new TreeMap<>();
clientes = Collections.emptyMap(); clientes = new TreeMap<>();
} }
public void nuevoHotel(Hotel hotel) { public void nuevoHotel(Hotel hotel) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment