Domande taggate «arraylist»

Un tipo di dati di raccolta semplice trovato in alcune lingue / piattaforme (come in Java o .NET). L'elenco di array implementa un elenco utilizzando un array, beneficiando di entrambi i punti di forza di DS.


4
Qual è la differenza tra <? estende Base> e <T estende Base>?
In questo esempio: import java.util.*; public class Example { static void doesntCompile(Map&lt;Integer, List&lt;? extends Number&gt;&gt; map) {} static &lt;T extends Number&gt; void compiles(Map&lt;Integer, List&lt;T&gt;&gt; map) {} static void function(List&lt;? extends Number&gt; outer) { doesntCompile(new HashMap&lt;Integer, List&lt;Integer&gt;&gt;()); compiles(new HashMap&lt;Integer, List&lt;Integer&gt;&gt;()); } } doesntCompile() non riesce a compilare con: Example.java:9: error: incompatible …

Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.