Guest User

Untitled

a guest
Aug 10th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. for (Item game: games) {
  2. //código para acceder a cada campo del Item.
  3. }
  4.  
  5. Name: Subnautica (Game Preview)
  6. Type: ---
  7. Descripcion Castellano: Este juego es un trabajo en curso...
  8. Descripcion Pegi:
  9. Edad Pegi: 16+
  10. Microsoft Store ID: bx3s1q5dvhrd
  11. Microsoft Store URL: subnautica-game-preview/bx3s1q5dvhrd
  12. Nota: 4.0
  13. Pertenece a: -
  14. Tipología de juego: Juego,
  15.  
  16. public String getNombre(){
  17. return this.nombre
  18. }
  19.  
  20. for (Juego game: games) {
  21. System.out.println(game.getNombre());
  22. }
  23.  
  24. Juego j;
  25.  
  26. for (i = 0; i<10; i++){
  27. j = new Juego();
  28. games.add(j);
  29. }
  30.  
  31. Juego j;
  32.  
  33. for (i = 0; i<10; i++){
  34. j = new Juego("Juego "+i);
  35. games.add(j);
  36. }
  37.  
  38. Juego j;
  39.  
  40. for (i = 0; i<10; i++){
  41. j = new Juego();
  42. j.setNombre("Juego "+i);
  43. games.add(j);
  44. }
  45.  
  46. public void setNombre (String nombre){
  47. this.nombre = nombre;
  48. }
  49.  
  50. Iterator<Item> it = lista.iterator();
  51. // mientras al iterador queda proximo juego
  52. while(it.hasNext()){
  53. Item item=it.next();
  54. System.out.println(item.toString());
  55. System.out.println("tipo: " + item.tipo);
  56. }
  57.  
  58. public class Item{
  59. public String nombre;
  60. public int type; // asumo codigo tres digitos?
  61. public String descCastellano;
  62. ...
  63.  
  64. @Override
  65. public String toString(){
  66. return String.format("%s: %s", nombre, descCastellano);
  67. }
  68. }
  69.  
  70. public class Juego{
  71. String titulo;
  72.  
  73. //Constructor
  74. public Juego(String titulo)
  75. {
  76. this.titulo = titulo;
  77. }
  78.  
  79. public String getTitulo()
  80. {
  81. return titulo;
  82. }
  83. }
  84.  
  85. ArrayList<Juego> juegos = new ArrayList<Juego>();
  86.  
  87. Juego juego = new Juego("lo que sea");
  88. juegos.add(juego);
  89.  
  90. for (Juego game: juegos) {
  91. System.out.println(game.getTitulo());
  92. }
  93.  
  94. item.getValues().put(Constants.PERTENECE, pertenece_a)
  95.  
  96. game.getValues().get(Constants.PERTENECE)
Add Comment
Please, Sign In to add comment