-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapFactory.java
More file actions
34 lines (28 loc) · 833 Bytes
/
Copy pathMapFactory.java
File metadata and controls
34 lines (28 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* @author: Hansel Lopez 19026 & Eduardo Ramírez 19946
* Hoja de Trabajo #6
* Algoritmos y estructuras de datos
*/
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.TreeMap;
public class MapFactory{
public Map<String, String> getMap(String mapType){
if(mapType == null){
System.out.println("-Se ha ingresado un valor no valido, por favor ingresar de nuevo...");
return null;
}
if(mapType.equalsIgnoreCase("HashMap")){
return new HashMap<String, String>();
}
if(mapType.equalsIgnoreCase("TreeMap")){
return new TreeMap<String, String>();
}
if(mapType.equalsIgnoreCase("LinkedHashMap")){
return new LinkedHashMap<String, String>();
}
System.out.println("-Se ha ingresado un valor no valido, por favor ingresar de nuevo...");
return null;
}
}