CREAR METODOS MAP

leosk8
28 de Septiembre del 2005
Queremos hacer la clase ManagerMap con los metodos de la clase managerList, pero no sabemos como hacerlo e implementarlos en la clase map, es decir metodos como remove, update, fill, get pero con de la forma Map, que son de una forma diferente que managerlist porque reciben key y object... no sabemos por donde empezar....????.
******manager list********
package Collections;
import java.util.*;
public class ManagerList(){
}
private list lista
public void crear(){
lista=new linkedList();
}
public void fill(Object objeto){
lista.add(objeto);
}
public object get(int index){
return lista(index);
}
public void update(int index,object vlr new){
lista.set(index, vlr new);
}
public void delete (int index){
lista.remove(index);
}
public void print (){
Iterator it =lista. iterator();
while(it.hasNext()){
System.out.print(it.next());
}
}
-------------------------------------------------------------------------
esta es la principal
import java.io*;
public static void main (String []arg ){
ManagerList lista = new ManagerList();
lista.crear();
bufferedReader bf=new BufferedReader;
boolean salir=false;
while salir=false;
while(salir){
System.out.print("ingresa valor");
object valor=bf.readline();
lista.fill(valor);
System.out.print("ingrese 1 para salir /n 2. para imprimir lista/n 3. eliminar/n 4.actualizar /n 5.buscar/n 6. seguir");
int op=integer.Parseint(bf.readLine());
swicth op{
case 1: salir=true;
break;
case 2:lista.print();
break;
case 3:system.out.print("ingrese posicion a eliminar");
int pos=Integer.ParseInt(bf.readLine());
lista.delete(pos);
break;
case 4: system.out.print("ingrese poscision a actualizar");
int pos=Integer.Parseint(bf.readLine());
lista.set(pos,valor);
break;
case 5: system.out.print("ingrese posicion abuscar");
int pos=Integer.PaseInt(bf.readLine());
ystem.out.print (lista.get(pos));
break;
case 6: break;
}
}
}