{"id":778,"date":"2008-08-28T02:27:00","date_gmt":"2008-08-28T01:27:00","guid":{"rendered":"http:\/\/karstieltopia.com\/2008\/08\/28\/problemillas-con-arrays-de-arraylist\/"},"modified":"2016-02-21T16:16:28","modified_gmt":"2016-02-21T15:16:28","slug":"problemillas-con-arrays-de-arraylist","status":"publish","type":"post","link":"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/","title":{"rendered":"Problemillas con arrays de ArrayList"},"content":{"rendered":"

Ayer me he topado con este problemilla en casa: resulta que a Java no le gusta para nada eso de crear un array de ArrayList y, por lo que he visto, no hay una forma “normal” para crear dicha cosa.<\/p>\n

Es decir, algo normal ser\u00eda:<\/p>\n

<br><br>ArrayList <e> element[] = new ArrayList <e> [size];<br><br><\/pre>\n

Pero ante \u00e9sto Java dice que tururu, as\u00ed que toca buscarse alguna alternativa. Y resulta que aqu\u00ed<\/a> he visto un par de soluciones posibles:<\/p>\n

<br><br>ArrayList <e> [] element = new ArrayList[size];<br><br><\/pre>\n

\u00f3<\/p>\n

<br><br>ArrayList <e> [] element = (ArrayList <e> [])new ArrayList[size];<br><br><\/pre>\n

Estas soluciones dan warnings, pero parece que funcionan correctamente ;)<\/p>\n

Si conoc\u00e9is otro m\u00e9todos, soy todo ojos ^^<\/e><\/e><\/e><\/e><\/e><\/p>\n","protected":false},"excerpt":{"rendered":"

Ayer me he topado con este problemilla en casa: resulta que a Java no le gusta para nada eso de crear un array de ArrayList y, por lo que he visto, no hay una forma “normal” para crear dicha cosa. Es decir, algo normal ser\u00eda: Pero ante \u00e9sto Java dice que tururu, as\u00ed que toca […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[22],"tags":[518,519],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"yoast_head":"\nProblemillas con arrays de ArrayList - Karstieltopia<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Problemillas con arrays de ArrayList - Karstieltopia\" \/>\n<meta property=\"og:description\" content=\"Ayer me he topado con este problemilla en casa: resulta que a Java no le gusta para nada eso de crear un array de ArrayList y, por lo que he visto, no hay una forma “normal” para crear dicha cosa. Es decir, algo normal ser\u00eda: Pero ante \u00e9sto Java dice que tururu, as\u00ed que toca […]\" \/>\n<meta property=\"og:url\" content=\"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/\" \/>\n<meta property=\"og:site_name\" content=\"Karstieltopia\" \/>\n<meta property=\"article:published_time\" content=\"2008-08-28T01:27:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-02-21T15:16:28+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@karstiel\" \/>\n<meta name=\"twitter:site\" content=\"@karstiel\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"http:\/\/karstieltopia.com\/#website\",\"url\":\"http:\/\/karstieltopia.com\/\",\"name\":\"Karstieltopia\",\"description\":\"Programaci\\u00f3n, tecnolog\\u00eda y a\\u00f1adidos\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"http:\/\/karstieltopia.com\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"es\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/#webpage\",\"url\":\"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/\",\"name\":\"Problemillas con arrays de ArrayList - Karstieltopia\",\"isPartOf\":{\"@id\":\"http:\/\/karstieltopia.com\/#website\"},\"datePublished\":\"2008-08-28T01:27:00+00:00\",\"dateModified\":\"2016-02-21T15:16:28+00:00\",\"author\":{\"@id\":\"http:\/\/karstieltopia.com\/#\/schema\/person\/3d09a55c38c7c00e78c41fa3f71a6e75\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/karstieltopia.com\/programacion\/java\/problemillas-con-arrays-de-arraylist\/\"]}]},{\"@type\":\"Person\",\"@id\":\"http:\/\/karstieltopia.com\/#\/schema\/person\/3d09a55c38c7c00e78c41fa3f71a6e75\",\"name\":\"karstiel\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6AuIG-cy","_links":{"self":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/778"}],"collection":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/comments?post=778"}],"version-history":[{"count":1,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/778\/revisions"}],"predecessor-version":[{"id":2278,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/posts\/778\/revisions\/2278"}],"wp:attachment":[{"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/media?parent=778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/categories?post=778"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/karstieltopia.com\/wp-json\/wp\/v2\/tags?post=778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}