ArrayList ו-HashMap ראשוניםFirst ArrayList & HashMap
רשימה שגדלה לבד, מילון של מפתח וערך, טיפוסים עטופים (Integer) ו-autoboxing.
A list that grows by itself, a key-value map, wrapper types (Integer) and autoboxing.
בסוף המפגש תדעוBy the end you will
- להשתמש ב-ArrayList:
add,get,set,remove,size,containsUse an ArrayList:add,get,set,remove,size,contains - להשתמש ב-HashMap:
put,get,getOrDefault,containsKey, ולעבור עלkeySetו-entrySetUse a HashMap:put,get,getOrDefault,containsKey, and loop overkeySetandentrySet - להבין <> וטיפוסים עוטפים (
Integer) ו-autoboxingUnderstand <>, wrapper types (Integer) and autoboxing - לספור דברים עם מילוןCount things with a map
לפני שמתחיליםBefore you start
זמן: Time: כ-3 שעות (כולל הפסקה)About 3 hours (with a break)
דרישות קודמות: Prerequisites: מפגשים 1–8Sessions 1–8
מה צריך: You need: מחשב עם JDK 21 ו-IntelliJ IDEA מותקנים (מפגש 1). אפשר גם רק דפדפן: כל הקוד מוצג עם הפלט האמיתי שלו, ורץ גם כאן כשהדפדפן מאפשר.A computer with JDK 21 and IntelliJ IDEA (session 1). A browser alone also works: every example shows its real output, and runs here when the browser allows it.
סדר המפגשSession plan
- 0:00פתיחה וחזרה קצרהOpening and quick review
- 0:10מונחיםTerms
- 0:25ArrayList: רשימה שגדלהArrayList: a list that grows
- 0:40רשימה של מספרים: Integer ו-autoboxingA list of numbers: Integer and autoboxing
- 0:55רשימה היא עצם: שתי הפניותA list is an object: two references
- 1:10הפסקהBreak
- 1:20HashMap: מפתח וערךHashMap: key and value
- 1:35ספירה עם מילוןCounting with a map
- 1:50טעויות נפוצותCommon mistakes
- 2:05פרויקט מדףShelf project
- 2:20תרגולPractice
- 2:50סיכום ושאלותWrap-up and questions
רשימה שגדלה לבד, מילון של מפתח וערך, טיפוסים עטופים (Integer) ו-autoboxing. בסוף המפגש מוסיפים צעד לפרויקט המלווה.
A list that grows by itself, a key-value map, wrapper types (Integer) and autoboxing. At the end we add a step to the companion project.
הפרויקט המלווהThe companion project: מדף: ספרייה אישיתShelf: a personal library
פרויקט אחד שגדל איתכם לאורך כל הקורס: מתחיל כתוכנית של 10 שורות, הופך למחלקות, ל-interfaces ול-streams, מייבא ספרים במקביל עם Threads, ונגמר כ-REST API.
One project that grows with you through the whole course: it starts as a 10-line program, becomes classes, interfaces and streams, imports books in parallel with threads, and ends as a REST API.
השלב של היוםToday's step המדף עובר ל-ArrayList, וספירת ספרים לפי סופרThe shelf moves to an ArrayList, plus a count of books per author. לתרגילGo to the exercise