Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2011
    Messaggi
    106

    [JAVA] HashSet

    Ciao ragazzi...un domanda :
    - Esiste un modo per ordinare un HashSet (numeri continui crescenti) senza trasformare essa in un altra struttura (tipo array o treeset ecc)?
    Da quanto ho capito probabilmente non si può però sto chiedendo a voi per avere confera.
    In più vorrei sapere se questo problema mi si ripresenterà anche con le LinkedHasSet e TreeMap.
    Grazie in anticipo ciao

  2. #2

    Re: [JAVA] HashSet

    Originariamente inviato da albymotard
    Ciao ragazzi...un domanda :
    - Esiste un modo per ordinare un HashSet (numeri continui crescenti) senza trasformare essa in un altra struttura (tipo array o treeset ecc)?
    Non è possibile. Usa TreeSet.

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2009
    Messaggi
    1,123
    HashSet, which stores its elements in a hash table, is the best-performing implementation; however it makes no guarantees concerning the order of iteration

    LinkedHashSet, which is implemented as a hash table with a linked list running through it, orders its elements based on the order in which they were inserted into the set (insertion-order).

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.