— Scott McNealy, Sun Microsystems Chairman, President and ceo



Download 40,57 Mb.
Pdf ko'rish
bet515/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   511   512   513   514   515   516   517   518   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)

dealing with 
duplicates


collections 
with 
generics
you are here
4
557
$
LIST
 - when 
sequence matters
Collections that know about 
index position.
Lists know where something is in the list. You 
can have more than one element referencing 
the same object.
SET 
- when 
uniqueness matters
Collections that 
do not allow duplicates.
Sets know whether something is already in the collection. 
You can never have more than one element referencing 
the same object (or more than one element referencing 
two objects that are considered equal—we’ll look at what 
object equality means in a moment).
MAP
 - when 
finding something by key matters
Collections that use 
key-value pairs.
Maps know the value associated with a given key. You 
can have two keys that reference the same value, but you 
cannot have duplicate keys. Although keys are typically 
String names (so that you can make name/value property 
lists, for example), a key can be any object.
Duplicates OK.
0 1 2 3
List
NO duplicates.
Set
Map
“Ball” “Fish” “Car”
Duplicate values OK, but NO duplicate keys.
“Ball1” “Ball2” “Fish” “Car”
$
$
From the Collection API, we fi nd three main interfaces, List, Set, and 
Map. ArrayList is a List, but it looks like Set is exactly what we need.
We need a Set instead of a List
Before sorting.


the collections 

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   511   512   513   514   515   516   517   518   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish