Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [Java]ArrayList
gregi
post
Post #1





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 11.09.2003

Ostrzeżenie: (0%)
-----


Szukam zgrabnej konstrukcji arraylist dwu wymiarowej
Czy mogę prosić aby ktoś pokazał implementację wraz z przykładowym mechanizmem zasilania w dane ?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
gregi
post
Post #2





Grupa: Zarejestrowani
Postów: 100
Pomógł: 0
Dołączył: 11.09.2003

Ostrzeżenie: (0%)
-----


na tą chwilę mam takiego dziwoląga i się zastanawiam czy da się bardziej uprościć

  1. ArrayList<ArrayList<Integer>> arrayList = new ArrayList<ArrayList<Integer>>();
  2.  
  3. ArrayList<Integer> lista1 = new ArrayList<Integer>();
  4. ArrayList<Integer> lista2 = new ArrayList<Integer>();
  5. ArrayList<Integer> lista3 = new ArrayList<Integer>();
  6.  
  7. lista1.add(1);
  8. lista1.add(2);
  9. lista1.add(3);
  10. lista1.add(4);
  11. lista2.add(5);
  12. lista2.add(6);
  13. lista2.add(7);
  14. lista2.add(8);
  15. lista3.add(9);
  16. lista3.add(10);
  17. lista3.add(11);
  18. lista3.add(12);
  19.  
  20. arrayList.add(lista1);
  21. arrayList.add(lista2);
  22. arrayList.add(lista3);
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 3.10.2025 - 04:47