class Lista<T>
{
private T[] arreglo;
public Lista(int tamanio)
{
arreglo = new T[tamanio];
}
public T ObtenerElemento(int indice)
{
return arreglo[indice];
}
public void AgregarElemento(int indice, T valor)
{
arreglo[indice] = valor;
}
}
public class PruebaLista
{
public static void Main ()
{
Lista<int> listaEnteros = new Lista<int>(5);
listaEnteros.AgregarElemento(0, 2);
listaEnteros.AgregarElemento(1, 3);
listaEnteros.AgregarElemento(2, 5);
listaEnteros.AgregarElemento(3, 7);
listaEnteros.AgregarElemento(4, 11);
Lista<double> listaDoubles = new Lista<double>(3);
listaDoubles.AgregarElemento(0, 7.11);
listaDoubles.AgregarElemento(1, 13.17);
listaDoubles.AgregarElemento(2, 19.23);
}
}
Y2xhc3MgTGlzdGE8VD4KewogICAgcHJpdmF0ZSBUW10gYXJyZWdsbzsKICAgIAogICAgcHVibGljIExpc3RhKGludCB0YW1hbmlvKQogICAgewogICAgICAgIGFycmVnbG8gPSBuZXcgVFt0YW1hbmlvXTsKICAgIH0KICAgIAogICAgcHVibGljIFQgT2J0ZW5lckVsZW1lbnRvKGludCBpbmRpY2UpCiAgICB7CiAgICAgICAgcmV0dXJuIGFycmVnbG9baW5kaWNlXTsKICAgIH0KICAgIAogICAgcHVibGljIHZvaWQgQWdyZWdhckVsZW1lbnRvKGludCBpbmRpY2UsIFQgdmFsb3IpCiAgICB7CiAgICAgICAgYXJyZWdsb1tpbmRpY2VdID0gdmFsb3I7CiAgICB9Cn0KCnB1YmxpYyBjbGFzcyBQcnVlYmFMaXN0YQp7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbiAoKQogICAgewogICAgICAgIExpc3RhPGludD4gbGlzdGFFbnRlcm9zID0gbmV3IExpc3RhPGludD4oNSk7CiAgICAgICAgCiAgICAgICAgbGlzdGFFbnRlcm9zLkFncmVnYXJFbGVtZW50bygwLCAyKTsKICAgICAgICBsaXN0YUVudGVyb3MuQWdyZWdhckVsZW1lbnRvKDEsIDMpOwogICAgICAgIGxpc3RhRW50ZXJvcy5BZ3JlZ2FyRWxlbWVudG8oMiwgNSk7CiAgICAgICAgbGlzdGFFbnRlcm9zLkFncmVnYXJFbGVtZW50bygzLCA3KTsKICAgICAgICBsaXN0YUVudGVyb3MuQWdyZWdhckVsZW1lbnRvKDQsIDExKTsKICAgICAgICAKICAgICAgICBMaXN0YTxkb3VibGU+IGxpc3RhRG91YmxlcyA9IG5ldyBMaXN0YTxkb3VibGU+KDMpOwogICAgICAgIAogICAgICAgIGxpc3RhRG91Ymxlcy5BZ3JlZ2FyRWxlbWVudG8oMCwgNy4xMSk7CiAgICAgICAgbGlzdGFEb3VibGVzLkFncmVnYXJFbGVtZW50bygxLCAxMy4xNyk7CiAgICAgICAgbGlzdGFEb3VibGVzLkFncmVnYXJFbGVtZW50bygyLCAxOS4yMyk7CiAgICB9Cn0=