Programmazione Parametrica ( a k. a. Generics ) Introduzione ai meccanismi e concetti della programmazione parametrica



Scaricare 446 b.
Pagina16/17
28.03.2019
Dimensione del file446 b.
1   ...   9   10   11   12   13   14   15   16   17



  • Listing All Elements with an Iterator



    File SetTester.java



    File SetTester.java



    File SetTester.java



    File SetTester.java



    File SetTester.java

    • Output



    Self Test

    • Arrays and lists remember the order in which you added elements; sets do not. Why would you want to use a set instead of an array or list?

    • Why are set iterators different from list iterators?



    Answers

    • Efficient set implementations can quickly test whether a given element is a member of the set.

    • Sets do not have an ordering, so it doesn't make sense to add an element at a particular iterator position, or to traverse a set backwards.



    Maps

    1   ...   9   10   11   12   13   14   15   16   17


    ©astratto.info 2019
    invia messaggio

        Pagina principale