[{"data":1,"prerenderedAt":3286},["ShallowReactive",2],{"item-lessons-light-ch16-writing-your-own-generics":3,"item-examples-light-ch16-writing-your-own-generics":444,"item-exercises-light-ch16-writing-your-own-generics":753,"item-lesson-full-ch16-writing-your-own-generics-16":1070,"item-example-full-ch16-writing-your-own-generics-16":1830,"item-exercise-full-ch16-writing-your-own-generics-16":2295},[4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,256,260,264,268,272,276,280,284,288,292,296,300,304,308,312,316,320,324,328,332,336,340,344,348,352,356,360,364,368,372,376,380,384,388,392,396,400,404,408,412,416,420,424,428,432,436,440],{"path":5,"title":6,"stem":7},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1-why-java-for-frc","Why Java for FRC?","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.1-why-java-for-frc",{"path":9,"title":10,"stem":11},"\u002Fshockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers","shockwave-curriculum\u002Flessons\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":13,"title":14,"stem":15},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":17,"title":18,"stem":19},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":21,"title":22,"stem":23},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":25,"title":26,"stem":27},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":29,"title":30,"stem":31},"\u002Fshockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators","shockwave-curriculum\u002Flessons\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":33,"title":34,"stem":35},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":37,"title":38,"stem":39},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":41,"title":42,"stem":43},"\u002Fshockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports","shockwave-curriculum\u002Flessons\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":45,"title":46,"stem":47},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":49,"title":50,"stem":51},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":53,"title":54,"stem":55},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":57,"title":58,"stem":59},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":61,"title":62,"stem":63},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":65,"title":66,"stem":67},"\u002Fshockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods","shockwave-curriculum\u002Flessons\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":69,"title":70,"stem":71},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","Control Structures: if Statements & For Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":73,"title":74,"stem":75},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":77,"title":78,"stem":79},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":81,"title":82,"stem":83},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":85,"title":86,"stem":87},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":89,"title":90,"stem":91},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":93,"title":94,"stem":95},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":97,"title":98,"stem":99},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":101,"title":102,"stem":103},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws)","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":105,"title":106,"stem":107},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F8-while-loops","While Loops","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.8-while-loops",{"path":109,"title":110,"stem":111},"\u002Fshockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms","shockwave-curriculum\u002Flessons\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":113,"title":114,"stem":115},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F1-strings","Strings","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.1-strings",{"path":117,"title":118,"stem":119},"\u002Fshockwave-curriculum\u002Flessons\u002Fch06-strings\u002F2-string-algorithms","String Algorithms","shockwave-curriculum\u002Flessons\u002Fch06-strings\u002F6.2-string-algorithms",{"path":121,"title":122,"stem":123},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","The Class Blueprint","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":125,"title":126,"stem":127},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":129,"title":130,"stem":131},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":133,"title":134,"stem":135},"\u002Fshockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods","shockwave-curriculum\u002Flessons\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":137,"title":138,"stem":139},"\u002Fshockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\"","shockwave-curriculum\u002Flessons\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":141,"title":142,"stem":143},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":145,"title":146,"stem":147},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":149,"title":150,"stem":151},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":153,"title":154,"stem":155},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":157,"title":158,"stem":159},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":161,"title":162,"stem":163},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":165,"title":166,"stem":167},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":169,"title":170,"stem":171},"\u002Fshockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files","shockwave-curriculum\u002Flessons\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":173,"title":174,"stem":175},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":177,"title":178,"stem":179},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":181,"title":182,"stem":183},"\u002Fshockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms","shockwave-curriculum\u002Flessons\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":185,"title":186,"stem":187},"\u002Fshockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices","shockwave-curriculum\u002Flessons\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":189,"title":190,"stem":191},"\u002Fshockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch","shockwave-curriculum\u002Flessons\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":193,"title":194,"stem":195},"\u002Fshockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas","shockwave-curriculum\u002Flessons\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":197,"title":198,"stem":199},"\u002Fshockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns?","shockwave-curriculum\u002Flessons\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":201,"title":202,"stem":203},"\u002Fshockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap)","shockwave-curriculum\u002Flessons\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":205,"title":206,"stem":207},"\u002Fshockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics","shockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":209,"title":210,"stem":211},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":213,"title":214,"stem":215},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":217,"title":218,"stem":219},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":221,"title":222,"stem":223},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":225,"title":226,"stem":227},"\u002Fshockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods","shockwave-curriculum\u002Flessons\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":229,"title":230,"stem":231},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":233,"title":234,"stem":235},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":237,"title":238,"stem":239},"\u002Fshockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism","shockwave-curriculum\u002Flessons\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":241,"title":242,"stem":243},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":245,"title":246,"stem":247},"\u002Fshockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References","shockwave-curriculum\u002Flessons\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":249,"title":250,"stem":251},"\u002Fshockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern","shockwave-curriculum\u002Flessons\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":253,"title":254,"stem":255},"\u002Fshockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories","Static Factories","shockwave-curriculum\u002Flessons\u002Fch21-static-factories\u002F21-static-factories",{"path":257,"title":258,"stem":259},"\u002Fshockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern","shockwave-curriculum\u002Flessons\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":261,"title":262,"stem":263},"\u002Fshockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability","shockwave-curriculum\u002Flessons\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":265,"title":266,"stem":267},"\u002Fshockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions","shockwave-curriculum\u002Flessons\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":269,"title":270,"stem":271},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming?","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":273,"title":274,"stem":275},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":277,"title":278,"stem":279},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":281,"title":282,"stem":283},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":285,"title":286,"stem":287},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":289,"title":290,"stem":291},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":293,"title":294,"stem":295},"\u002Fshockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project","shockwave-curriculum\u002Flessons\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":297,"title":298,"stem":299},"\u002Fshockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways","shockwave-curriculum\u002Flessons\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":301,"title":302,"stem":303},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":305,"title":306,"stem":307},"\u002Fshockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design","shockwave-curriculum\u002Flessons\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":309,"title":310,"stem":311},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":313,"title":314,"stem":315},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":317,"title":318,"stem":319},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":321,"title":322,"stem":323},"\u002Fshockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting","shockwave-curriculum\u002Flessons\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"path":325,"title":326,"stem":327},"\u002Fshockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F1-coming-soon","Git & GitHub Basics — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch29-git-and-github-basics\u002F29.1-coming-soon",{"path":329,"title":330,"stem":331},"\u002Fshockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F1-coming-soon","Git — History & Merging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch30-git-history-and-merging\u002F30.1-coming-soon",{"path":333,"title":334,"stem":335},"\u002Fshockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F1-coming-soon","Dev Environment & Tooling — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch31-dev-environment-and-tooling\u002F31.1-coming-soon",{"path":337,"title":338,"stem":339},"\u002Fshockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F1-coming-soon","Unit Testing — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch32-unit-testing\u002F32.1-coming-soon",{"path":341,"title":342,"stem":343},"\u002Fshockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F1-coming-soon","AdvantageKit — AutoLogging — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch33-advantagekit-autologging\u002F33.1-coming-soon",{"path":345,"title":346,"stem":347},"\u002Fshockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F1-coming-soon","Log Replay — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch34-log-replay\u002F34.1-coming-soon",{"path":349,"title":350,"stem":351},"\u002Fshockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F1-coming-soon","AdvantageScope I: Visualization — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch35-advantagescope-i-visualization\u002F35.1-coming-soon",{"path":353,"title":354,"stem":355},"\u002Fshockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F1-coming-soon","AdvantageScope II: Custom 3D Assets — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch36-advantagescope-ii-custom-3d-assets\u002F36.1-coming-soon",{"path":357,"title":358,"stem":359},"\u002Fshockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F1-coming-soon","Autonomous I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch37-autonomous-i\u002F37.1-coming-soon",{"path":361,"title":362,"stem":363},"\u002Fshockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F1-coming-soon","Autonomous II: PathPlanner & Trajectories — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch38-autonomous-ii-pathplanner-and-trajectories\u002F38.1-coming-soon",{"path":365,"title":366,"stem":367},"\u002Fshockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F1-coming-soon","Control Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch39-control-fundamentals\u002F39.1-coming-soon",{"path":369,"title":370,"stem":371},"\u002Fshockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F1-coming-soon","Motion Profiles — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch40-motion-profiles\u002F40.1-coming-soon",{"path":373,"title":374,"stem":375},"\u002Fshockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F1-coming-soon","Hardware Fundamentals — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch41-hardware-fundamentals\u002F41.1-coming-soon",{"path":377,"title":378,"stem":379},"\u002Fshockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F1-coming-soon","PhotonVision — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch42-photonvision\u002F42.1-coming-soon",{"path":381,"title":382,"stem":383},"\u002Fshockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F1-coming-soon","AprilTags & Pose — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch43-apriltags-and-pose\u002F43.1-coming-soon",{"path":385,"title":386,"stem":387},"\u002Fshockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F1-coming-soon","Subsystems I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch44-subsystems-i\u002F44.1-coming-soon",{"path":389,"title":390,"stem":391},"\u002Fshockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F1-coming-soon","Subsystems II — Advanced — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch45-subsystems-ii-advanced\u002F45.1-coming-soon",{"path":393,"title":394,"stem":395},"\u002Fshockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F1-coming-soon","Team Utilities I — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch46-team-utilities-i\u002F46.1-coming-soon",{"path":397,"title":398,"stem":399},"\u002Fshockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F1-coming-soon","Field Constants — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch47-field-constants\u002F47.1-coming-soon",{"path":401,"title":402,"stem":403},"\u002Fshockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F1-coming-soon","Troubleshooting I — Runtime Debug — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch48-troubleshooting-i-runtime-debug\u002F48.1-coming-soon",{"path":405,"title":406,"stem":407},"\u002Fshockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F1-coming-soon","Troubleshooting II: CAN & Sim — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch49-troubleshooting-ii-can-and-sim\u002F49.1-coming-soon",{"path":409,"title":410,"stem":411},"\u002Fshockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F1-coming-soon","Vendor Libraries: TalonFX — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch50-vendor-libraries-talonfx\u002F50.1-coming-soon",{"path":413,"title":414,"stem":415},"\u002Fshockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F1-coming-soon","Robot Alerts — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch51-robot-alerts\u002F51.1-coming-soon",{"path":417,"title":418,"stem":419},"\u002Fshockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F1-coming-soon","WPILib Commands — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch52-wpilib-commands\u002F52.1-coming-soon",{"path":421,"title":422,"stem":423},"\u002Fshockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F1-coming-soon","WPILib Geometry — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch53-wpilib-geometry\u002F53.1-coming-soon",{"path":425,"title":426,"stem":427},"\u002Fshockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F1-coming-soon","NetworkTables — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch54-networktables\u002F54.1-coming-soon",{"path":429,"title":430,"stem":431},"\u002Fshockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F1-coming-soon","Command Scheduler — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch55-command-scheduler\u002F55.1-coming-soon",{"path":433,"title":434,"stem":435},"\u002Fshockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F1-coming-soon","WPILib Timers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch56-wpilib-timers\u002F56.1-coming-soon",{"path":437,"title":438,"stem":439},"\u002Fshockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F1-coming-soon","WPILib Triggers — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch57-wpilib-triggers\u002F57.1-coming-soon",{"path":441,"title":442,"stem":443},"\u002Fshockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F1-coming-soon","Vendor Units & Conversions — Coming Soon","shockwave-curriculum\u002Flessons\u002Fch58-vendor-units-and-conversions\u002F58.1-coming-soon",[445,449,453,457,461,465,469,473,477,481,485,489,493,497,501,505,509,513,517,521,525,529,533,537,541,545,549,553,557,561,565,569,573,577,581,585,589,593,597,601,605,609,613,617,621,625,629,633,637,641,645,649,653,657,661,665,669,673,677,681,685,689,693,697,701,705,709,713,717,721,725,729,733,737,741,745,749],{"path":446,"title":447,"stem":448},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":450,"title":451,"stem":452},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":454,"title":455,"stem":456},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":458,"title":459,"stem":460},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":462,"title":463,"stem":464},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":466,"title":467,"stem":468},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":470,"title":471,"stem":472},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":474,"title":475,"stem":476},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":478,"title":479,"stem":480},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":482,"title":483,"stem":484},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":486,"title":487,"stem":488},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":490,"title":491,"stem":492},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":494,"title":495,"stem":496},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":498,"title":499,"stem":500},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":502,"title":503,"stem":504},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":506,"title":507,"stem":508},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":510,"title":511,"stem":512},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":514,"title":515,"stem":516},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":518,"title":519,"stem":520},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":522,"title":523,"stem":524},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":526,"title":527,"stem":528},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":530,"title":531,"stem":532},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":534,"title":535,"stem":536},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":538,"title":539,"stem":540},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":542,"title":543,"stem":544},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F8-while-loops","While Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.8-while-loops",{"path":546,"title":547,"stem":548},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":550,"title":551,"stem":552},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F1-strings","Strings — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.1-strings",{"path":554,"title":555,"stem":556},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch06-strings\u002F6.2-string-algorithms",{"path":558,"title":559,"stem":560},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":562,"title":563,"stem":564},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":566,"title":567,"stem":568},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":570,"title":571,"stem":572},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":574,"title":575,"stem":576},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":578,"title":579,"stem":580},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":582,"title":583,"stem":584},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":586,"title":587,"stem":588},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":590,"title":591,"stem":592},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":594,"title":595,"stem":596},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":598,"title":599,"stem":600},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":602,"title":603,"stem":604},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":606,"title":607,"stem":608},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":610,"title":611,"stem":612},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":614,"title":615,"stem":616},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":618,"title":619,"stem":620},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":622,"title":623,"stem":624},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":626,"title":627,"stem":628},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":630,"title":631,"stem":632},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":634,"title":635,"stem":636},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":638,"title":639,"stem":640},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":642,"title":643,"stem":644},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":646,"title":647,"stem":648},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":650,"title":651,"stem":652},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":654,"title":655,"stem":656},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":658,"title":659,"stem":660},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":662,"title":663,"stem":664},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":666,"title":667,"stem":668},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":670,"title":671,"stem":672},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":674,"title":675,"stem":676},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":678,"title":679,"stem":680},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":682,"title":683,"stem":684},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":686,"title":687,"stem":688},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch21-static-factories\u002F21-static-factories",{"path":690,"title":691,"stem":692},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":694,"title":695,"stem":696},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":698,"title":699,"stem":700},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":702,"title":703,"stem":704},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":706,"title":707,"stem":708},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":710,"title":711,"stem":712},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":714,"title":715,"stem":716},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":718,"title":719,"stem":720},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":722,"title":723,"stem":724},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":726,"title":727,"stem":728},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":730,"title":731,"stem":732},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":734,"title":735,"stem":736},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":738,"title":739,"stem":740},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":742,"title":743,"stem":744},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":746,"title":747,"stem":748},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":750,"title":751,"stem":752},"\u002Fshockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Worked Example","shockwave-curriculum\u002Fexamples\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",[754,758,762,766,770,774,778,782,786,790,794,798,802,806,810,814,818,822,826,830,834,838,842,846,850,854,858,862,866,870,874,878,882,886,890,894,898,902,906,910,914,918,922,926,930,934,938,942,946,950,954,958,962,966,970,974,978,982,986,990,994,998,1002,1006,1010,1014,1018,1022,1026,1030,1034,1038,1042,1046,1050,1054,1058,1062,1066],{"path":755,"title":756,"stem":757},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F2-intro-to-algorithms-programming-and-compilers","Intro to Algorithms, Programming and Compilers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch01-why-java-for-frc\u002F1.2-intro-to-algorithms-programming-and-compilers",{"path":759,"title":760,"stem":761},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F1-variables-and-data-types","Variables & Data Types — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.1-variables-and-data-types",{"path":763,"title":764,"stem":765},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2-expressions-and-output","Expressions & Output — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.2-expressions-and-output",{"path":767,"title":768,"stem":769},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F3-assignment-and-input","Assignment & Input — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.3-assignment-and-input",{"path":771,"title":772,"stem":773},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F4-casting-and-ranges-of-values","Casting & Ranges of Values — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.4-casting-and-ranges-of-values",{"path":775,"title":776,"stem":777},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F5-compound-assignment-operators","Compound Assignment Operators — Exercises","shockwave-curriculum\u002Fexercises\u002Fch02-variables-and-types\u002F2.5-compound-assignment-operators",{"path":779,"title":780,"stem":781},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F1-apis-and-libraries","APIs and Libraries — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.1-apis-and-libraries",{"path":783,"title":784,"stem":785},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F2-documentation-with-comments-and-preconditions","Documentation with Comments and Preconditions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.2-documentation-with-comments-and-preconditions",{"path":787,"title":788,"stem":789},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3-packages-and-imports","Packages & Imports — Exercises","shockwave-curriculum\u002Fexercises\u002Fch03-apis-libraries-and-documentation\u002F3.3-packages-and-imports",{"path":791,"title":792,"stem":793},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F1-methods-signatures-and-parameters","Methods, Signatures & Parameters — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.1-methods-signatures-and-parameters",{"path":795,"title":796,"stem":797},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F2-calling-class-methods","Calling Class Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.2-calling-class-methods",{"path":799,"title":800,"stem":801},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F3-using-the-math-class","Using the Math Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.3-using-the-math-class",{"path":803,"title":804,"stem":805},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4-objects-instances-of-classes","Objects — Instances of Classes — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.4-objects-instances-of-classes",{"path":807,"title":808,"stem":809},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F5-creating-and-initializing-objects-constructors","Creating & Initializing Objects: Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.5-creating-and-initializing-objects-constructors",{"path":811,"title":812,"stem":813},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F6-calling-instance-methods","Calling Instance Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch04-using-objects-and-calling-methods\u002F4.6-calling-instance-methods",{"path":815,"title":816,"stem":817},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F1-5.2-if-statements-and-for-loops","if Statements & For Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.1-5.2-if-statements-and-for-loops",{"path":819,"title":820,"stem":821},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F10-nested-iteration","Nested Iteration — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.10-nested-iteration",{"path":823,"title":824,"stem":825},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F11-informal-runtime-analysis-of-loops","Informal Runtime Analysis of Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.11-informal-runtime-analysis-of-loops",{"path":827,"title":828,"stem":829},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F12-switch-statements-and-expressions","switch Statements and Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.12-switch-statements-and-expressions",{"path":831,"title":832,"stem":833},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F3-algorithms-with-selection-and-repetition","Algorithms with Selection and Repetition — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.3-algorithms-with-selection-and-repetition",{"path":835,"title":836,"stem":837},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F4-boolean-expressions","Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.4-boolean-expressions",{"path":839,"title":840,"stem":841},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5-nested-if-statements","Nested if Statements — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.5-nested-if-statements",{"path":843,"title":844,"stem":845},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F6-compound-boolean-expressions","Compound Boolean Expressions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.6-compound-boolean-expressions",{"path":847,"title":848,"stem":849},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F7-comparing-boolean-expressions-de-morgans-laws","Comparing Boolean Expressions (De Morgan's Laws) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.7-comparing-boolean-expressions-de-morgans-laws",{"path":851,"title":852,"stem":853},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F8-while-loops","While Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.8-while-loops",{"path":855,"title":856,"stem":857},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F9-implementing-selection-and-iteration-algorithms","Implementing Selection and Iteration Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch05-control-structures\u002F5.9-implementing-selection-and-iteration-algorithms",{"path":859,"title":860,"stem":861},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F1-strings","Strings — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.1-strings",{"path":863,"title":864,"stem":865},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F2-string-algorithms","String Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch06-strings\u002F6.2-string-algorithms",{"path":867,"title":868,"stem":869},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F1-anatomy-of-a-java-class","Anatomy of a Java Class — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.1-anatomy-of-a-java-class",{"path":871,"title":872,"stem":873},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F2-methods-how-to-write-them","Methods: How to Write Them — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.2-methods-how-to-write-them",{"path":875,"title":876,"stem":877},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F3-methods-passing-and-returning-references-of-an-object","Methods: Passing & Returning References of an Object — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.3-methods-passing-and-returning-references-of-an-object",{"path":879,"title":880,"stem":881},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F4-class-static-variables-and-methods","Class (static) Variables & Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch07-the-class-blueprint\u002F7.4-class-static-variables-and-methods",{"path":883,"title":884,"stem":885},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F1-8.2-constructors-and-this","Constructors & \"this\" — Exercises","shockwave-curriculum\u002Fexercises\u002Fch08-constructors-and-this\u002F8.1-8.2-constructors-and-this",{"path":887,"title":888,"stem":889},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F1-array-creation-and-access","Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.1-array-creation-and-access",{"path":891,"title":892,"stem":893},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F2-arraylist-and-its-methods","ArrayList and its Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.2-arraylist-and-its-methods",{"path":895,"title":896,"stem":897},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F3-optional-hashmap-dictionary-data-structure","HashMap (Dictionary) Data Structure — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.3-optional-hashmap-dictionary-data-structure",{"path":899,"title":900,"stem":901},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F4-array-traversals","Array Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.4-array-traversals",{"path":903,"title":904,"stem":905},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F5-implementing-array-algorithms","Implementing Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.5-implementing-array-algorithms",{"path":907,"title":908,"stem":909},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F6-arraylist-traversals","ArrayList Traversals — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.6-arraylist-traversals",{"path":911,"title":912,"stem":913},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F7-implementing-arraylist-algorithms","Implementing ArrayList Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.7-implementing-arraylist-algorithms",{"path":915,"title":916,"stem":917},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F8-using-text-files","Using Text Files — Exercises","shockwave-curriculum\u002Fexercises\u002Fch09-storing-data\u002F9.8-using-text-files",{"path":919,"title":920,"stem":921},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F1-2d-array-creation-and-access","2D Array Creation and Access — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.1-2d-array-creation-and-access",{"path":923,"title":924,"stem":925},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F2-2d-array-traversals-nested-loops","2D Array Traversals: Nested Loops — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.2-2d-array-traversals-nested-loops",{"path":927,"title":928,"stem":929},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F3-implementing-2d-array-algorithms","Implementing 2D Array Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch10-2d-arrays\u002F10.3-implementing-2d-array-algorithms",{"path":931,"title":932,"stem":933},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices","Enums: Named Choices — Exercises","shockwave-curriculum\u002Fexercises\u002Fch11-enums-named-choices\u002F11-enums-named-choices",{"path":935,"title":936,"stem":937},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch","Exceptions & try\u002Fcatch — Exercises","shockwave-curriculum\u002Fexercises\u002Fch12-exceptions-and-try-catch\u002F12-exceptions-and-try-catch",{"path":939,"title":940,"stem":941},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas","Common Gotchas — Exercises","shockwave-curriculum\u002Fexercises\u002Fch13-common-gotchas\u002F13-common-gotchas",{"path":943,"title":944,"stem":945},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns","Why Design Patterns? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch14-why-design-patterns\u002F14-why-design-patterns",{"path":947,"title":948,"stem":949},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections","Advanced Collections (Set\u002FQueue\u002FMap) — Exercises","shockwave-curriculum\u002Fexercises\u002Fch15-advanced-collections\u002F15-advanced-collections",{"path":951,"title":952,"stem":953},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics","Writing Your Own Generics — Exercises","shockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics",{"path":955,"title":956,"stem":957},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F1-inheritance-superclass-subclass","Inheritance, Superclass, Subclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.1-inheritance-superclass-subclass",{"path":959,"title":960,"stem":961},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F2-inheritance-and-constructors","Inheritance and Constructors — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.2-inheritance-and-constructors",{"path":963,"title":964,"stem":965},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F3-inheritance-hierarchies","Inheritance Hierarchies — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.3-inheritance-hierarchies",{"path":967,"title":968,"stem":969},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F4-object-superclass","Object Superclass — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.4-object-superclass",{"path":971,"title":972,"stem":973},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F5-abstract-classes-and-methods","Abstract Classes and Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch17-inheritance-and-abstractions\u002F17.5-abstract-classes-and-methods",{"path":975,"title":976,"stem":977},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F1-overriding-methods","Overriding Methods — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.1-overriding-methods",{"path":979,"title":980,"stem":981},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F2-super-keyword","super Keyword — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.2-super-keyword",{"path":983,"title":984,"stem":985},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F3-polymorphism","Polymorphism — Exercises","shockwave-curriculum\u002Fexercises\u002Fch18-polymorphism-many-forms\u002F18.3-polymorphism",{"path":987,"title":988,"stem":989},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts","Interfaces as Contracts — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19-interfaces-as-contracts",{"path":991,"title":992,"stem":993},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F1-lambdas-and-method-references","Lambdas & Method References — Exercises","shockwave-curriculum\u002Fexercises\u002Fch19-interfaces-as-contracts\u002F19.1-lambdas-and-method-references",{"path":995,"title":996,"stem":997},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern","The IO-Layer Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch20-the-io-layer-pattern\u002F20-the-io-layer-pattern",{"path":999,"title":1000,"stem":1001},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories","Static Factories — Exercises","shockwave-curriculum\u002Fexercises\u002Fch21-static-factories\u002F21-static-factories",{"path":1003,"title":1004,"stem":1005},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern","The Builder Pattern — Exercises","shockwave-curriculum\u002Fexercises\u002Fch22-the-builder-pattern\u002F22-the-builder-pattern",{"path":1007,"title":1008,"stem":1009},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F1-scope-and-access","Access, final, and Immutability — Exercises","shockwave-curriculum\u002Fexercises\u002Fch23-encapsulation-and-final\u002F23.1-scope-and-access",{"path":1011,"title":1012,"stem":1013},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions","Optional: Avoiding Null Pointer Exceptions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch24-optional-avoiding-null-pointer-exceptions\u002F24-optional-avoiding-null-pointer-exceptions",{"path":1015,"title":1016,"stem":1017},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F1-what-is-command-based-programming","What Is Command-Based Programming? — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.1-what-is-command-based-programming",{"path":1019,"title":1020,"stem":1021},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F2-commands-and-command-compositions","Commands & Command Compositions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.2-commands-and-command-compositions",{"path":1023,"title":1024,"stem":1025},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F3-the-command-scheduler","The Command Scheduler — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.3-the-command-scheduler",{"path":1027,"title":1028,"stem":1029},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F4-state-machines-logic","State Machines: Logic — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.4-state-machines-logic",{"path":1031,"title":1032,"stem":1033},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F5-managing-transitions","Managing Transitions — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.5-managing-transitions",{"path":1035,"title":1036,"stem":1037},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F6-binding-commands-to-triggers","Binding Commands to Triggers — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.6-binding-commands-to-triggers",{"path":1039,"title":1040,"stem":1041},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F7-structuring-a-command-based-robot-project","Structuring a Command-Based Robot Project — Exercises","shockwave-curriculum\u002Fexercises\u002Fch25-command-based-programming\u002F25.7-structuring-a-command-based-robot-project",{"path":1043,"title":1044,"stem":1045},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways","Architecture Takeaways — Exercises","shockwave-curriculum\u002Fexercises\u002Fch26-architecture-takeaways\u002F26-architecture-takeaways",{"path":1047,"title":1048,"stem":1049},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F1-abstraction-and-program-design","Abstraction and Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.1-abstraction-and-program-design",{"path":1051,"title":1052,"stem":1053},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F2-impact-of-program-design","Impact of Program Design — Exercises","shockwave-curriculum\u002Fexercises\u002Fch27-program-design-and-abstraction\u002F27.2-impact-of-program-design",{"path":1055,"title":1056,"stem":1057},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F1-searching-algorithms","Searching Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.1-searching-algorithms",{"path":1059,"title":1060,"stem":1061},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F2-sorting-algorithms","Sorting Algorithms — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.2-sorting-algorithms",{"path":1063,"title":1064,"stem":1065},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F3-recursion","Recursion — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.3-recursion",{"path":1067,"title":1068,"stem":1069},"\u002Fshockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F4-recursive-searching-and-sorting","Recursive Searching and Sorting — Exercises","shockwave-curriculum\u002Fexercises\u002Fch28-algorithms-searching-sorting-recursion\u002F28.4-recursive-searching-and-sorting",{"id":1071,"title":206,"body":1072,"description":1823,"extension":1824,"meta":1825,"navigation":1234,"path":205,"seo":1828,"stem":207,"__hash__":1829},"lessons\u002Fshockwave-curriculum\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics.md",{"type":1073,"value":1074,"toc":1813},"minimark",[1075,1079,1099,1104,1111,1140,1160,1167,1192,1196,1210,1254,1264,1294,1320,1326,1415,1419,1422,1458,1469,1473,1497,1515,1553,1579,1583,1604,1608,1615,1641,1652,1656,1734,1738,1782,1809],[1076,1077,206],"h1",{"id":1078},"writing-your-own-generics",[1080,1081,1082,1086,1087,1086,1090,1093,1094,1098],"p",{},[1083,1084,1085],"code",{},"List\u003CString>",", ",[1083,1088,1089],{},"Map\u003CInteger, Double>",[1083,1091,1092],{},"ArrayList\u003CDouble>"," — every collection since Ch.9 has ",[1095,1096,1097],"em",{},"used"," a generic type someone else wrote. This chapter is about writing your own.",[1100,1101,1103],"h2",{"id":1102},"why-generics-exist","Why Generics Exist",[1080,1105,1106,1107,1110],{},"Before generics, a reusable container had to work with the generic ",[1083,1108,1109],{},"Object"," type, requiring an explicit cast every time you got something back out — and nothing stopped the wrong type from going in in the first place:",[1112,1113,1118],"pre",{"className":1114,"code":1115,"language":1116,"meta":1117,"style":1117},"language-java shiki shiki-themes github-light github-dark","List list = new ArrayList();         \u002F\u002F no generics\nlist.add(\"hello\");\nString s = (String) list.get(0);     \u002F\u002F cast required, and could fail at runtime\n","java","",[1083,1119,1120,1128,1134],{"__ignoreMap":1117},[1121,1122,1125],"span",{"class":1123,"line":1124},"line",1,[1121,1126,1127],{},"List list = new ArrayList();         \u002F\u002F no generics\n",[1121,1129,1131],{"class":1123,"line":1130},2,[1121,1132,1133],{},"list.add(\"hello\");\n",[1121,1135,1137],{"class":1123,"line":1136},3,[1121,1138,1139],{},"String s = (String) list.get(0);     \u002F\u002F cast required, and could fail at runtime\n",[1080,1141,1142,1143,1146,1147,1151,1152,1155,1156,1159],{},"The ",[1083,1144,1145],{},"(String)"," is a ",[1148,1149,1150],"strong",{},"cast",": it forces the compiler to treat the value as that type. If the object handed back weren't actually a ",[1083,1153,1154],{},"String",", this line would compile fine and then throw ",[1083,1157,1158],{},"ClassCastException"," at runtime instead of failing to compile.",[1080,1161,1162,1163,1166],{},"With a type parameter, the compiler enforces correctness ",[1095,1164,1165],{},"before"," the program ever runs, and the cast disappears entirely:",[1112,1168,1170],{"className":1114,"code":1169,"language":1116,"meta":1117,"style":1117},"List\u003CString> list = new ArrayList\u003CString>();\nlist.add(\"hello\");\n\u002F\u002F no cast — the compiler already knows it's a String\nString s = list.get(0);\n",[1083,1171,1172,1177,1181,1186],{"__ignoreMap":1117},[1121,1173,1174],{"class":1123,"line":1124},[1121,1175,1176],{},"List\u003CString> list = new ArrayList\u003CString>();\n",[1121,1178,1179],{"class":1123,"line":1130},[1121,1180,1133],{},[1121,1182,1183],{"class":1123,"line":1136},[1121,1184,1185],{},"\u002F\u002F no cast — the compiler already knows it's a String\n",[1121,1187,1189],{"class":1123,"line":1188},4,[1121,1190,1191],{},"String s = list.get(0);\n",[1100,1193,1195],{"id":1194},"writing-a-generic-class","Writing a Generic Class",[1080,1197,1198,1199,1202,1203,1206,1207,1209],{},"A generic class introduces one or more ",[1148,1200,1201],{},"type parameters"," in angle brackets after the class name. Here's a value wrapper — a natural fit for logging one tunable robot value (a setpoint, a gain, a mode name) without having to commit to ",[1083,1204,1205],{},"double"," or ",[1083,1208,1154],{}," up front, using a placeholder type instead:",[1112,1211,1213],{"className":1114,"code":1212,"language":1116,"meta":1117,"style":1117},"public class LoggedValue\u003CT>\n{\n    private T value;\n\n    public void set(T v) { value = v; }\n    public T get() { return value; }\n}\n",[1083,1214,1215,1220,1225,1230,1236,1242,1248],{"__ignoreMap":1117},[1121,1216,1217],{"class":1123,"line":1124},[1121,1218,1219],{},"public class LoggedValue\u003CT>\n",[1121,1221,1222],{"class":1123,"line":1130},[1121,1223,1224],{},"{\n",[1121,1226,1227],{"class":1123,"line":1136},[1121,1228,1229],{},"    private T value;\n",[1121,1231,1232],{"class":1123,"line":1188},[1121,1233,1235],{"emptyLinePlaceholder":1234},true,"\n",[1121,1237,1239],{"class":1123,"line":1238},5,[1121,1240,1241],{},"    public void set(T v) { value = v; }\n",[1121,1243,1245],{"class":1123,"line":1244},6,[1121,1246,1247],{},"    public T get() { return value; }\n",[1121,1249,1251],{"class":1123,"line":1250},7,[1121,1252,1253],{},"}\n",[1080,1255,1256,1259,1260,1263],{},[1083,1257,1258],{},"T"," isn't a real type — it's a ",[1148,1261,1262],{},"type variable",", a placeholder standing in for whatever concrete type gets supplied when the class is actually used:",[1112,1265,1267],{"className":1114,"code":1266,"language":1116,"meta":1117,"style":1117},"\u002F\u002F the \"diamond\" \u003C> — compiler infers Double from the left side\nLoggedValue\u003CDouble> setpoint = new LoggedValue\u003C>();\nsetpoint.set(3.5);    \u002F\u002F OK\n\u002F\u002F compile error — a String doesn't belong in a LoggedValue\u003CDouble>\nsetpoint.set(\"fast\");\n",[1083,1268,1269,1274,1279,1284,1289],{"__ignoreMap":1117},[1121,1270,1271],{"class":1123,"line":1124},[1121,1272,1273],{},"\u002F\u002F the \"diamond\" \u003C> — compiler infers Double from the left side\n",[1121,1275,1276],{"class":1123,"line":1130},[1121,1277,1278],{},"LoggedValue\u003CDouble> setpoint = new LoggedValue\u003C>();\n",[1121,1280,1281],{"class":1123,"line":1136},[1121,1282,1283],{},"setpoint.set(3.5);    \u002F\u002F OK\n",[1121,1285,1286],{"class":1123,"line":1188},[1121,1287,1288],{},"\u002F\u002F compile error — a String doesn't belong in a LoggedValue\u003CDouble>\n",[1121,1290,1291],{"class":1123,"line":1238},[1121,1292,1293],{},"setpoint.set(\"fast\");\n",[1080,1295,1296,1297,1299,1300,1303,1304,1307,1308,1311,1312,1315,1316,1319],{},"By convention, type parameters are single uppercase letters — ",[1083,1298,1258],{}," (Type), ",[1083,1301,1302],{},"E"," (Element, used throughout the collections you already know), ",[1083,1305,1306],{},"K","\u002F",[1083,1309,1310],{},"V"," (Key\u002FValue, as in ",[1083,1313,1314],{},"Map\u003CK, V>","), ",[1083,1317,1318],{},"N"," (Number). This convention exists specifically so a type variable is instantly recognizable and never confused with a real class name.",[1080,1321,1322,1323,1325],{},"A generic class can take more than one type parameter, exactly like ",[1083,1324,1314],{}," does:",[1112,1327,1329],{"className":1114,"code":1328,"language":1116,"meta":1117,"style":1117},"public class Pair\u003CK, V>\n{\n    private K key;\n    private V value;\n\n    public Pair(K key, V value)\n    {\n        this.key = key;\n        this.value = value;\n    }\n\n    public K getKey()   { return key; }\n    public V getValue() { return value; }\n}\n\nPair\u003CString, Double> reading = new Pair\u003C>(\"Front-Left Current\", 12.4);\n",[1083,1330,1331,1336,1340,1345,1350,1354,1359,1364,1370,1376,1382,1387,1393,1399,1404,1409],{"__ignoreMap":1117},[1121,1332,1333],{"class":1123,"line":1124},[1121,1334,1335],{},"public class Pair\u003CK, V>\n",[1121,1337,1338],{"class":1123,"line":1130},[1121,1339,1224],{},[1121,1341,1342],{"class":1123,"line":1136},[1121,1343,1344],{},"    private K key;\n",[1121,1346,1347],{"class":1123,"line":1188},[1121,1348,1349],{},"    private V value;\n",[1121,1351,1352],{"class":1123,"line":1238},[1121,1353,1235],{"emptyLinePlaceholder":1234},[1121,1355,1356],{"class":1123,"line":1244},[1121,1357,1358],{},"    public Pair(K key, V value)\n",[1121,1360,1361],{"class":1123,"line":1250},[1121,1362,1363],{},"    {\n",[1121,1365,1367],{"class":1123,"line":1366},8,[1121,1368,1369],{},"        this.key = key;\n",[1121,1371,1373],{"class":1123,"line":1372},9,[1121,1374,1375],{},"        this.value = value;\n",[1121,1377,1379],{"class":1123,"line":1378},10,[1121,1380,1381],{},"    }\n",[1121,1383,1385],{"class":1123,"line":1384},11,[1121,1386,1235],{"emptyLinePlaceholder":1234},[1121,1388,1390],{"class":1123,"line":1389},12,[1121,1391,1392],{},"    public K getKey()   { return key; }\n",[1121,1394,1396],{"class":1123,"line":1395},13,[1121,1397,1398],{},"    public V getValue() { return value; }\n",[1121,1400,1402],{"class":1123,"line":1401},14,[1121,1403,1253],{},[1121,1405,1407],{"class":1123,"line":1406},15,[1121,1408,1235],{"emptyLinePlaceholder":1234},[1121,1410,1412],{"class":1123,"line":1411},16,[1121,1413,1414],{},"Pair\u003CString, Double> reading = new Pair\u003C>(\"Front-Left Current\", 12.4);\n",[1100,1416,1418],{"id":1417},"generic-methods","Generic Methods",[1080,1420,1421],{},"A single method — even inside an otherwise non-generic class — can introduce its own type parameter, written in angle brackets right before the return type. Its scope is limited to that one method:",[1112,1423,1425],{"className":1114,"code":1424,"language":1116,"meta":1117,"style":1117},"public class Util\n{\n    public static \u003CK, V> boolean sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)\n    {\n        return p1.getKey().equals(p2.getKey()) && p1.getValue().equals(p2.getValue());\n    }\n}\n",[1083,1426,1427,1432,1436,1441,1445,1450,1454],{"__ignoreMap":1117},[1121,1428,1429],{"class":1123,"line":1124},[1121,1430,1431],{},"public class Util\n",[1121,1433,1434],{"class":1123,"line":1130},[1121,1435,1224],{},[1121,1437,1438],{"class":1123,"line":1136},[1121,1439,1440],{},"    public static \u003CK, V> boolean sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)\n",[1121,1442,1443],{"class":1123,"line":1188},[1121,1444,1363],{},[1121,1446,1447],{"class":1123,"line":1238},[1121,1448,1449],{},"        return p1.getKey().equals(p2.getKey()) && p1.getValue().equals(p2.getValue());\n",[1121,1451,1452],{"class":1123,"line":1244},[1121,1453,1381],{},[1121,1455,1456],{"class":1123,"line":1250},[1121,1457,1253],{},[1080,1459,1460,1461,1464,1465,1468],{},"Almost always, the compiler figures out the type on its own from how you call it — this is ",[1148,1462,1463],{},"type inference"," — so you can call ",[1083,1466,1467],{},"Util.sameEntry(p1, p2)"," directly, without ever writing the type parameter yourself.",[1100,1470,1472],{"id":1471},"bounded-type-parameters","Bounded Type Parameters",[1080,1474,1475,1476,1479,1480,1482,1483,1086,1486,1489,1490,1493,1494,1496],{},"A quick primer before this section's example: ",[1083,1477,1478],{},"Number"," is a Java class — like ",[1083,1481,1109],{},", the ultimate parent of every class in Java (Ch.17 covers what that relationship means for classes you write yourself) — that ",[1083,1484,1485],{},"Integer",[1083,1487,1488],{},"Double",", and the other numeric wrapper classes all ",[1083,1491,1492],{},"extends",". That's what makes \"any subtype of ",[1083,1495,1478],{},"\" a meaningful thing to say, and it's the same \"is a more specific kind of\" relationship Ch.17 covers in full.",[1080,1498,1499,1500,1503,1504,1506,1507,1509,1510,1086,1512,1514],{},"Sometimes a generic type shouldn't accept ",[1095,1501,1502],{},"just anything"," — a method built around numeric comparisons only makes sense for actual numbers. ",[1083,1505,1492],{}," restricts a type parameter to a specific type (or subtype of it) — here meaning \"any subtype of ",[1083,1508,1478],{},",\" which covers ",[1083,1511,1485],{},[1083,1513,1488],{},", and the rest:",[1112,1516,1518],{"className":1114,"code":1517,"language":1116,"meta":1117,"style":1117},"public static \u003CT extends Number> double clampedValue(T value, double min, double max)\n{\n    double v = value.doubleValue(); \u002F\u002F legal — Number guarantees a doubleValue() method\n    if (v \u003C min) return min;\n    if (v > max) return max;\n    return v;\n}\n",[1083,1519,1520,1525,1529,1534,1539,1544,1549],{"__ignoreMap":1117},[1121,1521,1522],{"class":1123,"line":1124},[1121,1523,1524],{},"public static \u003CT extends Number> double clampedValue(T value, double min, double max)\n",[1121,1526,1527],{"class":1123,"line":1130},[1121,1528,1224],{},[1121,1530,1531],{"class":1123,"line":1136},[1121,1532,1533],{},"    double v = value.doubleValue(); \u002F\u002F legal — Number guarantees a doubleValue() method\n",[1121,1535,1536],{"class":1123,"line":1188},[1121,1537,1538],{},"    if (v \u003C min) return min;\n",[1121,1540,1541],{"class":1123,"line":1238},[1121,1542,1543],{},"    if (v > max) return max;\n",[1121,1545,1546],{"class":1123,"line":1244},[1121,1547,1548],{},"    return v;\n",[1121,1550,1551],{"class":1123,"line":1250},[1121,1552,1253],{},[1080,1554,1555,1556,1559,1560,1563,1564,1567,1568,1571,1572,1575,1576,1578],{},"Without the ",[1083,1557,1558],{},"extends Number"," bound, ",[1083,1561,1562],{},"value.doubleValue()"," wouldn't compile at all — the compiler would only know ",[1083,1565,1566],{},"value"," is ",[1095,1569,1570],{},"some"," type, with no guarantee it has a ",[1083,1573,1574],{},"doubleValue()"," method to call. The bound is what unlocks calling methods that only ",[1083,1577,1478],{}," (and its subtypes) actually have.",[1100,1580,1582],{"id":1581},"wildcards-a-quick-preview","Wildcards: A Quick Preview",[1080,1584,1142,1585,1588,1589,1592,1593,1595,1596,1599,1600,1603],{},[1083,1586,1587],{},"?"," wildcard represents an unknown type, mostly useful for parameters and fields where you want to accept \"a ",[1083,1590,1591],{},"List"," of anything\" without pinning down exactly what. Wildcard variations (upper-bounded, lower-bounded) go beyond what this chapter covers — the short version to remember for now is: ",[1083,1594,1587],{}," is never used when ",[1095,1597,1598],{},"creating"," a generic type (",[1083,1601,1602],{},"new Box\u003C?>()"," isn't a thing) — only when referring to one you don't need to be specific about.",[1100,1605,1607],{"id":1606},"what-generics-cant-do","What Generics Can't Do",[1080,1609,1610,1611,1614],{},"Generics only exist at compile time — the compiler checks everything, then largely erases the type information before the program runs (this is called ",[1148,1612,1613],{},"type erasure","). That limits what a generic class can do with its own type parameter:",[1616,1617,1618,1626,1632],"ul",{},[1619,1620,1621,1622,1625],"li",{},"No ",[1083,1623,1624],{},"new T()"," — the compiler doesn't know at runtime which constructor to call.",[1619,1627,1621,1628,1631],{},[1083,1629,1630],{},"new T[10]"," — creating an array of the type parameter doesn't compile, for the same reason.",[1619,1633,1621,1634,1637,1638,1640],{},[1083,1635,1636],{},"static"," field or method of type ",[1083,1639,1258],{}," — a type parameter belongs to each individual object, not to the class itself.",[1080,1642,1643,1644,1647,1648,1651],{},"Skipping the type argument entirely (",[1083,1645,1646],{},"List list = new ArrayList();",", this lesson's very first snippet) is called a ",[1148,1649,1650],{},"raw type"," — it compiles, but with an \"unchecked\" warning, not a hard error. Java kept raw types working only so pre-generics code (written before Java 5) wouldn't break; never write one on purpose in new code.",[1100,1653,1655],{"id":1654},"common-pitfalls","Common Pitfalls",[1616,1657,1658,1679,1696,1718],{},[1619,1659,1660,1667,1668,1671,1672,1674,1675,1678],{},[1148,1661,1662,1663,1666],{},"Forgetting the ",[1083,1664,1665],{},"\u003CT>"," on the class declaration itself."," ",[1083,1669,1670],{},"public class Box { private T t; }"," doesn't compile — ",[1083,1673,1258],{}," has to be introduced with ",[1083,1676,1677],{},"public class Box\u003CT>"," before it can be used anywhere inside the class.",[1619,1680,1681,1667,1684,1687,1688,1691,1692,1695],{},[1148,1682,1683],{},"Using a primitive as a type argument.",[1083,1685,1686],{},"LoggedValue\u003Cdouble>"," doesn't compile — type arguments must be reference types, so use the wrapper (",[1083,1689,1690],{},"LoggedValue\u003CDouble>",") instead, same rule as ",[1083,1693,1694],{},"ArrayList"," (Lesson 9.2).",[1619,1697,1698,1667,1701,1703,1704,1706,1707,1709,1710,1567,1712,1714,1715,1717],{},[1148,1699,1700],{},"Calling a bound-specific method without the bound.",[1083,1702,1562],{}," only compiles once ",[1083,1705,1258],{}," is declared ",[1083,1708,1558],{}," — without the bound, the compiler only knows ",[1083,1711,1258],{},[1095,1713,1570],{}," type, with no guaranteed methods beyond what every ",[1083,1716,1109],{}," has.",[1619,1719,1720,1733],{},[1148,1721,1722,1723,1086,1725,1728,1729,1732],{},"Expecting ",[1083,1724,1624],{},[1083,1726,1727],{},"new T[]",", or a ",[1083,1730,1731],{},"static T"," to work."," Type erasure means none of them compile — see \"What Generics Can't Do\" above.",[1100,1735,1737],{"id":1736},"key-takeaways","Key Takeaways",[1616,1739,1740,1747,1753,1756,1766,1777],{},[1619,1741,1742,1743,1746],{},"A generic class introduces type parameters in angle brackets after its name (",[1083,1744,1745],{},"class LoggedValue\u003CT>","); the type variable then stands in for a real type anywhere in the class.",[1619,1748,1749,1750,1752],{},"Generic types replace the old cast-from-",[1083,1751,1109],{}," pattern with compile-time type safety — a wrong type is now a compile error, not a runtime surprise.",[1619,1754,1755],{},"A generic method can introduce its own type parameter, scoped to just that method; the compiler usually infers the type automatically.",[1619,1757,1758,1761,1762,1765],{},[1083,1759,1760],{},"\u003CT extends SomeType>"," restricts what a type parameter can be, and unlocks calling ",[1083,1763,1764],{},"SomeType","'s own methods on values of that type.",[1619,1767,1768,1769,1086,1771,1773,1774,1776],{},"Type erasure means a generic class can't ",[1083,1770,1624],{},[1083,1772,1727],{},", or use ",[1083,1775,1258],{}," statically; skipping the type argument entirely compiles as a raw type, with an unchecked warning.",[1619,1778,1142,1779,1781],{},[1083,1780,1587],{}," wildcard represents an unknown type for referring to a generic type generically — it's never used when constructing one.",[1080,1783,1784,1785,1788,1789,1086,1792,1086,1795,1086,1798,1086,1801,1804,1805,1808],{},"Derived from ",[1083,1786,1787],{},"other-reference-repo",": ",[1083,1790,1791],{},"oracle-java-tutorials\u002Fgenerics\u002F01-why-use-generics.md",[1083,1793,1794],{},"02-generic-types.md",[1083,1796,1797],{},"03-generic-methods.md",[1083,1799,1800],{},"04-bounded-type-parameters.md",[1083,1802,1803],{},"05-wildcards.md"," (ORACLE 14.1-5)\n",[1148,1806,1807],{},"Deck context:"," mechacoder-test\u002Fsrc\u002Flessons\u002Fjava-2.js, slide 2 (\"Writing Your Own Generics\")",[1810,1811,1812],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":1117,"searchDepth":1130,"depth":1130,"links":1814},[1815,1816,1817,1818,1819,1820,1821,1822],{"id":1102,"depth":1130,"text":1103},{"id":1194,"depth":1130,"text":1195},{"id":1417,"depth":1130,"text":1418},{"id":1471,"depth":1130,"text":1472},{"id":1581,"depth":1130,"text":1582},{"id":1606,"depth":1130,"text":1607},{"id":1654,"depth":1130,"text":1655},{"id":1736,"depth":1130,"text":1737},"List\u003CString>, Map\u003CInteger, Double>, ArrayList\u003CDouble> — every collection since Ch.9 has used a generic type someone else wrote. This chapter is about writing your own.","md",{"outlineRef":1826,"status":1827},"16 — Writing Your Own Generics (ORACLE 14.1-5)","new — authored lesson (fuller depth than the teaser slide)",{"title":206,"description":1823},"CC9y_sDKKbHDlNMUNn4jxParJWIItoEX5NhCRF0udqE",{"id":1831,"title":639,"body":1832,"description":1117,"extension":1824,"meta":2290,"navigation":1234,"path":638,"seo":2293,"stem":640,"__hash__":2294},"examples\u002Fshockwave-curriculum\u002Fexamples\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics.md",{"type":1073,"value":1833,"toc":2281},[1834,1837,1841,1858,1862,1880,1884,1895,1899,1999,2024,2028,2067,2096,2106,2115,2119,2155,2177,2206,2231,2234,2243,2247,2279],[1076,1835,639],{"id":1836},"writing-your-own-generics-worked-example",[1100,1838,1840],{"id":1839},"problem","Problem",[1080,1842,1843,1844,1846,1847,1849,1850,1853,1854,1857],{},"The dashboard should show both the current value and the previous value for several robot readings, so drivers can spot a sudden jump. The arm angle is a ",[1083,1845,1488],{},", and the drive mode is a ",[1083,1848,1154],{},". Write one reusable class that remembers \"current and previous\" for a value of ",[1095,1851,1852],{},"any"," type. Then write a method that computes how much a ",[1095,1855,1856],{},"numeric"," reading changed, one that only accepts number readings.",[1100,1859,1861],{"id":1860},"step-1-plan-it-first","Step 1: Plan It First",[1863,1864,1865,1871,1874],"ol",{},[1619,1866,1867,1868,1870],{},"One class that works for any value type means a generic class with a type parameter ",[1083,1869,1258],{},".",[1619,1872,1873],{},"The class holds two values of that same type (current and previous). Updating it moves current into previous, then stores the new value as current.",[1619,1875,1876,1877,1870],{},"\"How much did it change\" only makes sense for numbers, so the method needs a bounded type parameter: ",[1083,1878,1879],{},"T extends Number",[1100,1881,1883],{"id":1882},"step-2-why-not-just-write-two-classes","Step 2: Why Not Just Write Two Classes?",[1080,1885,1886,1887,1890,1891,1894],{},"Without generics, this would need a ",[1083,1888,1889],{},"DoubleReading"," class for the arm angle and a separate ",[1083,1892,1893],{},"StringReading"," class for the drive mode, with identical logic and only the field types different. Every future reading type would need yet another copy. With a type parameter, one class covers all of them, and the compiler still checks that each reading only ever holds its own type.",[1100,1896,1898],{"id":1897},"step-3-write-the-generic-class","Step 3: Write the Generic Class",[1112,1900,1902],{"className":1114,"code":1901,"language":1116,"meta":1117,"style":1117},"public class LatestReading\u003CT>\n{\n    private T current;\n    private T previous;\n\n    public LatestReading(T initial)\n    {\n        current = initial;\n        previous = initial;\n    }\n\n    public void update(T newValue)\n    {\n        previous = current;\n        current = newValue;\n    }\n\n    public T getCurrent()  { return current; }\n    public T getPrevious() { return previous; }\n}\n",[1083,1903,1904,1909,1913,1918,1923,1927,1932,1936,1941,1946,1950,1954,1959,1963,1968,1973,1977,1982,1988,1994],{"__ignoreMap":1117},[1121,1905,1906],{"class":1123,"line":1124},[1121,1907,1908],{},"public class LatestReading\u003CT>\n",[1121,1910,1911],{"class":1123,"line":1130},[1121,1912,1224],{},[1121,1914,1915],{"class":1123,"line":1136},[1121,1916,1917],{},"    private T current;\n",[1121,1919,1920],{"class":1123,"line":1188},[1121,1921,1922],{},"    private T previous;\n",[1121,1924,1925],{"class":1123,"line":1238},[1121,1926,1235],{"emptyLinePlaceholder":1234},[1121,1928,1929],{"class":1123,"line":1244},[1121,1930,1931],{},"    public LatestReading(T initial)\n",[1121,1933,1934],{"class":1123,"line":1250},[1121,1935,1363],{},[1121,1937,1938],{"class":1123,"line":1366},[1121,1939,1940],{},"        current = initial;\n",[1121,1942,1943],{"class":1123,"line":1372},[1121,1944,1945],{},"        previous = initial;\n",[1121,1947,1948],{"class":1123,"line":1378},[1121,1949,1381],{},[1121,1951,1952],{"class":1123,"line":1384},[1121,1953,1235],{"emptyLinePlaceholder":1234},[1121,1955,1956],{"class":1123,"line":1389},[1121,1957,1958],{},"    public void update(T newValue)\n",[1121,1960,1961],{"class":1123,"line":1395},[1121,1962,1363],{},[1121,1964,1965],{"class":1123,"line":1401},[1121,1966,1967],{},"        previous = current;\n",[1121,1969,1970],{"class":1123,"line":1406},[1121,1971,1972],{},"        current = newValue;\n",[1121,1974,1975],{"class":1123,"line":1411},[1121,1976,1381],{},[1121,1978,1980],{"class":1123,"line":1979},17,[1121,1981,1235],{"emptyLinePlaceholder":1234},[1121,1983,1985],{"class":1123,"line":1984},18,[1121,1986,1987],{},"    public T getCurrent()  { return current; }\n",[1121,1989,1991],{"class":1123,"line":1990},19,[1121,1992,1993],{},"    public T getPrevious() { return previous; }\n",[1121,1995,1997],{"class":1123,"line":1996},20,[1121,1998,1253],{},[1080,2000,1142,2001,2003,2004,2006,2007,2009,2010,2013,2014,2017,2018,2021,2022,1870],{},[1083,2002,1665],{}," after the class name introduces the type variable. Without it, ",[1083,2005,1258],{}," wouldn't compile anywhere inside the class. After that, ",[1083,2008,1258],{}," stands in for the real type everywhere: both fields, the constructor parameter, ",[1083,2011,2012],{},"update","'s parameter, and both getters' return types. The constructor sets both fields to the starting value, so ",[1083,2015,2016],{},"getPrevious()"," never returns ",[1083,2019,2020],{},"null"," before the first ",[1083,2023,2012],{},[1100,2025,2027],{"id":2026},"step-4-use-it-with-two-different-types","Step 4: Use It With Two Different Types",[1112,2029,2031],{"className":1114,"code":2030,"language":1116,"meta":1117,"style":1117},"LatestReading\u003CDouble> armAngle = new LatestReading\u003C>(42.0);\narmAngle.update(45.5);\nSystem.out.println(armAngle.getPrevious() + \" -> \" + armAngle.getCurrent()); \u002F\u002F 42.0 -> 45.5\n\nLatestReading\u003CString> driveMode = new LatestReading\u003C>(\"Field-Relative\");\ndriveMode.update(\"Robot-Relative\");\nSystem.out.println(\"Switched from \" + driveMode.getPrevious()); \u002F\u002F Switched from Field-Relative\n",[1083,2032,2033,2038,2043,2048,2052,2057,2062],{"__ignoreMap":1117},[1121,2034,2035],{"class":1123,"line":1124},[1121,2036,2037],{},"LatestReading\u003CDouble> armAngle = new LatestReading\u003C>(42.0);\n",[1121,2039,2040],{"class":1123,"line":1130},[1121,2041,2042],{},"armAngle.update(45.5);\n",[1121,2044,2045],{"class":1123,"line":1136},[1121,2046,2047],{},"System.out.println(armAngle.getPrevious() + \" -> \" + armAngle.getCurrent()); \u002F\u002F 42.0 -> 45.5\n",[1121,2049,2050],{"class":1123,"line":1188},[1121,2051,1235],{"emptyLinePlaceholder":1234},[1121,2053,2054],{"class":1123,"line":1238},[1121,2055,2056],{},"LatestReading\u003CString> driveMode = new LatestReading\u003C>(\"Field-Relative\");\n",[1121,2058,2059],{"class":1123,"line":1244},[1121,2060,2061],{},"driveMode.update(\"Robot-Relative\");\n",[1121,2063,2064],{"class":1123,"line":1250},[1121,2065,2066],{},"System.out.println(\"Switched from \" + driveMode.getPrevious()); \u002F\u002F Switched from Field-Relative\n",[1080,2068,2069,2070,2073,2074,2076,2077,2079,2080,2082,2083,2085,2086,2089,2090,2093,2094,1870],{},"The diamond ",[1083,2071,2072],{},"\u003C>"," lets the compiler infer ",[1083,2075,1488],{}," (and then ",[1083,2078,1154],{},") from the left side. The type argument is ",[1083,2081,1488],{},", not ",[1083,2084,1205],{},", because type arguments must be reference types. ",[1083,2087,2088],{},"42.0"," and ",[1083,2091,2092],{},"45.5"," are autoboxed automatically, the same as with ",[1083,2095,1092],{},[1080,2097,2098,2099,1146,2102,2105],{},"Because ",[1083,2100,2101],{},"armAngle",[1083,2103,2104],{},"LatestReading\u003CDouble>",", the compiler rejects the wrong type before the program ever runs:",[1112,2107,2109],{"className":1114,"code":2108,"language":1116,"meta":1117,"style":1117},"armAngle.update(\"fast\"); \u002F\u002F compile error — a String doesn't belong in a LatestReading\u003CDouble>\n",[1083,2110,2111],{"__ignoreMap":1117},[1121,2112,2113],{"class":1123,"line":1124},[1121,2114,2108],{},[1100,2116,2118],{"id":2117},"step-5-the-bounded-method-only-numbers-allowed","Step 5: The Bounded Method — Only Numbers Allowed",[1112,2120,2122],{"className":1114,"code":2121,"language":1116,"meta":1117,"style":1117},"public class ReadingMath\n{\n    public static \u003CT extends Number> double change(LatestReading\u003CT> reading)\n    {\n        return reading.getCurrent().doubleValue() - reading.getPrevious().doubleValue();\n    }\n}\n",[1083,2123,2124,2129,2133,2138,2142,2147,2151],{"__ignoreMap":1117},[1121,2125,2126],{"class":1123,"line":1124},[1121,2127,2128],{},"public class ReadingMath\n",[1121,2130,2131],{"class":1123,"line":1130},[1121,2132,1224],{},[1121,2134,2135],{"class":1123,"line":1136},[1121,2136,2137],{},"    public static \u003CT extends Number> double change(LatestReading\u003CT> reading)\n",[1121,2139,2140],{"class":1123,"line":1188},[1121,2141,1363],{},[1121,2143,2144],{"class":1123,"line":1238},[1121,2145,2146],{},"        return reading.getCurrent().doubleValue() - reading.getPrevious().doubleValue();\n",[1121,2148,2149],{"class":1123,"line":1244},[1121,2150,1381],{},[1121,2152,2153],{"class":1123,"line":1250},[1121,2154,1253],{},[1080,2156,2157,2160,2161,2164,2165,2167,2168,1567,2170,2172,2173,2176],{},[1083,2158,2159],{},"\u003CT extends Number>"," goes right before the return type, and it belongs to this one method only. The bound is what makes ",[1083,2162,2163],{},".doubleValue()"," legal. With a plain ",[1083,2166,1665],{},", the compiler would only know ",[1083,2169,1258],{},[1095,2171,1570],{}," type, and ",[1083,2174,2175],{},"getCurrent().doubleValue()"," would fail with \"cannot find symbol.\"",[1112,2178,2180],{"className":1114,"code":2179,"language":1116,"meta":1117,"style":1117},"System.out.println(ReadingMath.change(armAngle)); \u002F\u002F 3.5\n\nLatestReading\u003CInteger> piecesScored = new LatestReading\u003C>(3);\npiecesScored.update(5);\nSystem.out.println(ReadingMath.change(piecesScored)); \u002F\u002F 2.0\n",[1083,2181,2182,2187,2191,2196,2201],{"__ignoreMap":1117},[1121,2183,2184],{"class":1123,"line":1124},[1121,2185,2186],{},"System.out.println(ReadingMath.change(armAngle)); \u002F\u002F 3.5\n",[1121,2188,2189],{"class":1123,"line":1130},[1121,2190,1235],{"emptyLinePlaceholder":1234},[1121,2192,2193],{"class":1123,"line":1136},[1121,2194,2195],{},"LatestReading\u003CInteger> piecesScored = new LatestReading\u003C>(3);\n",[1121,2197,2198],{"class":1123,"line":1188},[1121,2199,2200],{},"piecesScored.update(5);\n",[1121,2202,2203],{"class":1123,"line":1238},[1121,2204,2205],{},"System.out.println(ReadingMath.change(piecesScored)); \u002F\u002F 2.0\n",[1080,2207,2208,2209,2211,2212,2215,2216,2218,2219,2221,2222,2082,2225,2228,2229,1870],{},"Type inference works out ",[1083,2210,1258],{}," from the argument, so the call is just ",[1083,2213,2214],{},"ReadingMath.change(armAngle)",". ",[1083,2217,1485],{}," works too, since it's also a subtype of ",[1083,2220,1478],{},". The result is ",[1083,2223,2224],{},"2.0",[1083,2226,2227],{},"2",", because the method returns a ",[1083,2230,1205],{},[1080,2232,2233],{},"The drive-mode reading is correctly rejected:",[1112,2235,2237],{"className":1114,"code":2236,"language":1116,"meta":1117,"style":1117},"ReadingMath.change(driveMode); \u002F\u002F compile error — String isn't a subtype of Number\n",[1083,2238,2239],{"__ignoreMap":1117},[1121,2240,2241],{"class":1123,"line":1124},[1121,2242,2236],{},[1100,2244,2246],{"id":2245},"recap","Recap",[1616,2248,2249,2255,2258,2268,2271],{},[1619,2250,2251,2254],{},[1083,2252,2253],{},"public class LatestReading\u003CT>"," introduces a type variable that stands in for a real type everywhere inside the class: fields, parameters, and return types.",[1619,2256,2257],{},"One generic class replaces a separate copy per type, and the compiler still rejects the wrong type at compile time.",[1619,2259,2069,2260,2262,2263,1307,2265,2267],{},[1083,2261,2072],{}," lets the compiler infer the type argument. Type arguments must be wrapper types like ",[1083,2264,1488],{},[1083,2266,1485],{},", never primitives.",[1619,2269,2270],{},"A generic method declares its own type parameter before its return type, and the compiler infers it from the arguments.",[1619,2272,2273,2275,2276,2278],{},[1083,2274,2159],{}," limits the method to number types and is what makes calling ",[1083,2277,1574],{}," legal.",[1810,2280,1812],{},{"title":1117,"searchDepth":1130,"depth":1130,"links":2282},[2283,2284,2285,2286,2287,2288,2289],{"id":1839,"depth":1130,"text":1840},{"id":1860,"depth":1130,"text":1861},{"id":1882,"depth":1130,"text":1883},{"id":1897,"depth":1130,"text":1898},{"id":2026,"depth":1130,"text":2027},{"id":2117,"depth":1130,"text":2118},{"id":2245,"depth":1130,"text":2246},{"outlineRef":1826,"pairsWith":2291,"status":2292},"[`lessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics.md`](..\u002F..\u002Flessons\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics.md)","new — authored worked example (fully solved, walked step by step — not a problem to attempt)",{"title":639,"description":1117},"jEhbDwaXz3ZKJ9ORJloaLwK-wFBoet4EBL2c5vdJd8c",{"id":2296,"title":952,"body":2297,"description":1117,"extension":1824,"meta":3282,"navigation":1234,"path":951,"seo":3284,"stem":953,"__hash__":3285},"exercises\u002Fshockwave-curriculum\u002Fexercises\u002Fch16-writing-your-own-generics\u002F16-writing-your-own-generics.md",{"type":1073,"value":2298,"toc":3277},[2299,2302,2306,2326,2331,2357,2363,2386,2424,2428,2454,2457,2531,2536,2542,2604,2686,2690,2696,2716,2761,2770,2778,2783,2918,2923,2928,2934,2939,2944,2949,2953,2959,2963,2969,2974,2978,2984,2988,2994,2999,3003,3009,3013,3019,3024,3028,3034,3038,3044,3049,3229,3275],[1076,2300,952],{"id":2301},"writing-your-own-generics-exercises",[1100,2303,2305],{"id":2304},"multiple-choice","Multiple Choice",[1080,2307,2308,2311,2312,1086,2314,2316,2317,2319,2320,2322,2323,1587],{},[1148,2309,2310],{},"Question:"," A teammate wants a generic method that accepts any number type (",[1083,2313,1485],{},[1083,2315,1488],{},", and so on) and returns it as a ",[1083,2318,1205],{}," by calling ",[1083,2321,1562],{}," inside the body. Which method header compiles, with the body ",[1083,2324,2325],{},"return value.doubleValue();",[1080,2327,2328],{},[1148,2329,2330],{},"Options:",[1616,2332,2333,2339,2345,2351],{},[1619,2334,2335,2336],{},"A. ",[1083,2337,2338],{},"public static \u003CT> double toDouble(T value)",[1619,2340,2341,2342],{},"B. ",[1083,2343,2344],{},"public static \u003CT extends Number> double toDouble(T value)",[1619,2346,2347,2348],{},"C. ",[1083,2349,2350],{},"public static double toDouble(T value)",[1619,2352,2353,2354],{},"D. ",[1083,2355,2356],{},"public static \u003CT> double toDouble(T extends Number value)",[1080,2358,2359,2362],{},[1148,2360,2361],{},"Answer:"," B",[1080,2364,2365,1667,2368,2370,2371,2373,2374,2376,2377,2379,2380,2382,2383,2385],{},[1148,2366,2367],{},"Why:",[1083,2369,2159],{}," introduces the type variable ",[1083,2372,1258],{}," and restricts it to ",[1083,2375,1478],{}," and its subtypes. Because of that bound, the compiler knows every possible ",[1083,2378,1258],{}," has a ",[1083,2381,1574],{}," method, so ",[1083,2384,1562],{}," compiles.",[1616,2387,2388,2402,2414],{},[1619,2389,2390,2391,2393,2394,1567,2396,2398,2399,2401],{},"A is wrong because ",[1083,2392,1665],{}," has no bound, so the compiler only knows ",[1083,2395,1566],{},[1095,2397,1570],{}," type. It has no guarantee of a ",[1083,2400,1574],{}," method, and the call fails with \"cannot find symbol.\"",[1619,2403,2404,2405,2407,2408,2410,2411,2413],{},"C is wrong because ",[1083,2406,1258],{}," is never introduced. There's no ",[1083,2409,1665],{}," before the return type, so ",[1083,2412,1258],{}," isn't a known type at all and the header itself doesn't compile.",[1619,2415,2416,2417,2419,2420,2423],{},"D is wrong because the bound belongs where the type parameter is declared (",[1083,2418,2159],{},"), not in the parameter list. ",[1083,2421,2422],{},"T extends Number value"," is a syntax error.",[1100,2425,2427],{"id":2426},"micro-parsons","Micro-Parsons",[1080,2429,2430,2433,2434,2437,2438,2441,2442,2444,2445,2448,2449,2451,2452,1870],{},[1148,2431,2432],{},"Problem:"," These lines, once correctly ordered, form a complete program: a generic ",[1083,2435,2436],{},"Tunable\u003CT>"," class that can hold a tuning value of any type, plus a ",[1083,2439,2440],{},"main"," method that uses it to store a ",[1083,2443,1488],{}," gain of ",[1083,2446,2447],{},"0.05"," and print it. The program should print ",[1083,2450,2447],{},". Put the class's field and methods above ",[1083,2453,2440],{},[1080,2455,2456],{},"Reorder the fragments below into a working program:",[1616,2458,2459,2465,2471,2477,2483,2489,2495,2501,2507,2513,2519,2525],{},[1619,2460,2461,2462],{},"a. ",[1083,2463,2464],{},"        kP.set(0.05);",[1619,2466,2467,2468],{},"b. ",[1083,2469,2470],{},"    public T get() { return value; }",[1619,2472,2473,2474],{},"c. ",[1083,2475,2476],{},"{",[1619,2478,2479,2480],{},"d. ",[1083,2481,2482],{},"        System.out.println(kP.get());",[1619,2484,2485,2486],{},"e. ",[1083,2487,2488],{},"    public static void main(String[] args)",[1619,2490,2491,2492],{},"f. ",[1083,2493,2494],{},"}",[1619,2496,2497,2498],{},"g. ",[1083,2499,2500],{},"    private T value;",[1619,2502,2503,2504],{},"h. ",[1083,2505,2506],{},"        Tunable\u003CDouble> kP = new Tunable\u003C>();",[1619,2508,2509,2510],{},"i. ",[1083,2511,2512],{},"public class Tunable\u003CT>",[1619,2514,2515,2516],{},"j. ",[1083,2517,2518],{},"    }",[1619,2520,2521,2522],{},"k. ",[1083,2523,2524],{},"    public void set(T v) { value = v; }",[1619,2526,2527,2528],{},"l. ",[1083,2529,2530],{},"    {",[1080,2532,2533,2535],{},[1148,2534,2361],{}," i, c, g, k, b, e, l, h, a, d, j, f",[1080,2537,2538,2541],{},[1148,2539,2540],{},"Interchangeable:"," (g, k, b)",[1112,2543,2545],{"className":1114,"code":2544,"language":1116,"meta":1117,"style":1117},"public class Tunable\u003CT>\n{\n    private T value;\n    public void set(T v) { value = v; }\n    public T get() { return value; }\n\n    public static void main(String[] args)\n    {\n        Tunable\u003CDouble> kP = new Tunable\u003C>();\n        kP.set(0.05);\n        System.out.println(kP.get());\n    }\n}\n",[1083,2546,2547,2552,2556,2560,2564,2568,2572,2577,2581,2586,2591,2596,2600],{"__ignoreMap":1117},[1121,2548,2549],{"class":1123,"line":1124},[1121,2550,2551],{},"public class Tunable\u003CT>\n",[1121,2553,2554],{"class":1123,"line":1130},[1121,2555,1224],{},[1121,2557,2558],{"class":1123,"line":1136},[1121,2559,1229],{},[1121,2561,2562],{"class":1123,"line":1188},[1121,2563,1241],{},[1121,2565,2566],{"class":1123,"line":1238},[1121,2567,1247],{},[1121,2569,2570],{"class":1123,"line":1244},[1121,2571,1235],{"emptyLinePlaceholder":1234},[1121,2573,2574],{"class":1123,"line":1250},[1121,2575,2576],{},"    public static void main(String[] args)\n",[1121,2578,2579],{"class":1123,"line":1366},[1121,2580,1363],{},[1121,2582,2583],{"class":1123,"line":1372},[1121,2584,2585],{},"        Tunable\u003CDouble> kP = new Tunable\u003C>();\n",[1121,2587,2588],{"class":1123,"line":1378},[1121,2589,2590],{},"        kP.set(0.05);\n",[1121,2592,2593],{"class":1123,"line":1384},[1121,2594,2595],{},"        System.out.println(kP.get());\n",[1121,2597,2598],{"class":1123,"line":1389},[1121,2599,1381],{},[1121,2601,2602],{"class":1123,"line":1395},[1121,2603,1253],{},[1080,2605,2606,2609,2610,2613,2614,2616,2617,2620,2621,2624,2625,1086,2628,2631,2632,2634,2635,2638,2639,2642,2643,2645,2646,2649,2650,2653,2654,2634,2657,2660,2661,2634,2664,2667,2668,2671,2672,2674,2675,2677,2678,2681,2682,2685],{},[1148,2607,2608],{},"Why this order:"," The class line (",[1083,2611,2612],{},"i",") comes first, since it introduces ",[1083,2615,1258],{},", and its opening brace (",[1083,2618,2619],{},"c",") follows. Inside the class, the field (",[1083,2622,2623],{},"g",") and the two methods (",[1083,2626,2627],{},"k",[1083,2629,2630],{},"b",") can go in any order among themselves: Java doesn't care whether a field is declared above or below the methods that use it. Putting the field first is just the usual convention. ",[1083,2633,2440],{}," (",[1083,2636,2637],{},"e",") and its opening brace (",[1083,2640,2641],{},"l",") come next. Inside ",[1083,2644,2440],{},", the ",[1083,2647,2648],{},"Tunable\u003CDouble>"," has to be created (",[1083,2651,2652],{},"h",") before anything can be stored in it. The value must be ",[1083,2655,2656],{},"set",[1083,2658,2659],{},"a",") before ",[1083,2662,2663],{},"get",[1083,2665,2666],{},"d",") can print it, or ",[1083,2669,2670],{},"get()"," would print ",[1083,2673,2020],{},". The braces close in reverse: ",[1083,2676,2440],{},"'s body (",[1083,2679,2680],{},"j","), then the class's body (",[1083,2683,2684],{},"f",").",[1100,2687,2689],{"id":2688},"coding","Coding",[1080,2691,2692,2695],{},[1148,2693,2694],{},"Mode:"," full-program",[1080,2697,2698,2700,2701,2704,2705,2708,2709,2711,2712,1206,2714,1870],{},[1148,2699,2432],{}," Write a generic class ",[1083,2702,2703],{},"Pair\u003CK, V>"," and a generic method ",[1083,2706,2707],{},"Util.sameEntry",". The\nfixed ",[1083,2710,2440],{}," uses them with three different type arguments, so nothing may be hard-coded to\n",[1083,2713,1154],{},[1083,2715,1488],{},[1616,2717,2718,2739],{},[1619,2719,2720,2722,2723,2726,2727,2730,2731,2733,2734,2730,2737,2685],{},[1083,2721,2703],{}," holds a key and a value. Its constructor takes ",[1083,2724,2725],{},"(K key, V value)",", and it has\n",[1083,2728,2729],{},"getKey()"," (returns a ",[1083,2732,1306],{},") and ",[1083,2735,2736],{},"getValue()",[1083,2738,1310],{},[1619,2740,2741,2744,2745,2748,2749,2752,2753,2756,2757,2760],{},[1083,2742,2743],{},"Util.sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)"," is a static generic method that returns ",[1083,2746,2747],{},"true","\nwhen the two pairs have equal keys ",[1148,2750,2751],{},"and"," equal values, and ",[1083,2754,2755],{},"false"," otherwise. Two separate\n",[1083,2758,2759],{},"Pair"," objects built from the same text and number count as the same entry.",[1080,2762,1142,2763,2765,2766,2769],{},[1083,2764,2440],{}," reads two telemetry readings (a name and a number each) and a slot (an ID number and a\nname), then prints three lines. For the input ",[1083,2767,2768],{},"FL_Current 12.5 FL_Current 12.5 3 Left",":",[1112,2771,2776],{"className":2772,"code":2774,"language":2775,"meta":1117},[2773],"language-text","FL_Current -> 12.5\ntrue\n4 LEFT\n","text",[1083,2777,2774],{"__ignoreMap":1117},[1080,2779,2780],{},[1148,2781,2782],{},"Starter:",[1112,2784,2786],{"className":1114,"code":2785,"language":1116,"meta":1117,"style":1117},"import java.util.*;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        Scanner in = new Scanner(System.in);\n        Pair\u003CString, Double> a = new Pair\u003C>(in.next(), in.nextDouble());\n        Pair\u003CString, Double> b = new Pair\u003C>(in.next(), in.nextDouble());\n        Pair\u003CInteger, String> slot = new Pair\u003C>(in.nextInt(), in.next());\n        System.out.println(a.getKey() + \" -> \" + a.getValue());\n        System.out.println(Util.sameEntry(a, b));\n        int nextId = slot.getKey() + 1;\n        System.out.println(nextId + \" \" + slot.getValue().toUpperCase());\n    }\n}\n\n\u002F\u002F TODO: make Pair generic, with two type parameters\nclass Pair\n{\n}\n\nclass Util\n{\n    \u002F\u002F TODO: a static generic method sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)\n}\n",[1083,2787,2788,2793,2797,2802,2806,2811,2815,2819,2824,2829,2834,2839,2844,2849,2854,2859,2863,2867,2871,2876,2881,2886,2891,2896,2902,2907,2913],{"__ignoreMap":1117},[1121,2789,2790],{"class":1123,"line":1124},[1121,2791,2792],{},"import java.util.*;\n",[1121,2794,2795],{"class":1123,"line":1130},[1121,2796,1235],{"emptyLinePlaceholder":1234},[1121,2798,2799],{"class":1123,"line":1136},[1121,2800,2801],{},"public class Main\n",[1121,2803,2804],{"class":1123,"line":1188},[1121,2805,1224],{},[1121,2807,2808],{"class":1123,"line":1238},[1121,2809,2810],{},"    \u002F\u002F Don't change main\n",[1121,2812,2813],{"class":1123,"line":1244},[1121,2814,2576],{},[1121,2816,2817],{"class":1123,"line":1250},[1121,2818,1363],{},[1121,2820,2821],{"class":1123,"line":1366},[1121,2822,2823],{},"        Scanner in = new Scanner(System.in);\n",[1121,2825,2826],{"class":1123,"line":1372},[1121,2827,2828],{},"        Pair\u003CString, Double> a = new Pair\u003C>(in.next(), in.nextDouble());\n",[1121,2830,2831],{"class":1123,"line":1378},[1121,2832,2833],{},"        Pair\u003CString, Double> b = new Pair\u003C>(in.next(), in.nextDouble());\n",[1121,2835,2836],{"class":1123,"line":1384},[1121,2837,2838],{},"        Pair\u003CInteger, String> slot = new Pair\u003C>(in.nextInt(), in.next());\n",[1121,2840,2841],{"class":1123,"line":1389},[1121,2842,2843],{},"        System.out.println(a.getKey() + \" -> \" + a.getValue());\n",[1121,2845,2846],{"class":1123,"line":1395},[1121,2847,2848],{},"        System.out.println(Util.sameEntry(a, b));\n",[1121,2850,2851],{"class":1123,"line":1401},[1121,2852,2853],{},"        int nextId = slot.getKey() + 1;\n",[1121,2855,2856],{"class":1123,"line":1406},[1121,2857,2858],{},"        System.out.println(nextId + \" \" + slot.getValue().toUpperCase());\n",[1121,2860,2861],{"class":1123,"line":1411},[1121,2862,1381],{},[1121,2864,2865],{"class":1123,"line":1979},[1121,2866,1253],{},[1121,2868,2869],{"class":1123,"line":1984},[1121,2870,1235],{"emptyLinePlaceholder":1234},[1121,2872,2873],{"class":1123,"line":1990},[1121,2874,2875],{},"\u002F\u002F TODO: make Pair generic, with two type parameters\n",[1121,2877,2878],{"class":1123,"line":1996},[1121,2879,2880],{},"class Pair\n",[1121,2882,2884],{"class":1123,"line":2883},21,[1121,2885,1224],{},[1121,2887,2889],{"class":1123,"line":2888},22,[1121,2890,1253],{},[1121,2892,2894],{"class":1123,"line":2893},23,[1121,2895,1235],{"emptyLinePlaceholder":1234},[1121,2897,2899],{"class":1123,"line":2898},24,[1121,2900,2901],{},"class Util\n",[1121,2903,2905],{"class":1123,"line":2904},25,[1121,2906,1224],{},[1121,2908,2910],{"class":1123,"line":2909},26,[1121,2911,2912],{},"    \u002F\u002F TODO: a static generic method sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)\n",[1121,2914,2916],{"class":1123,"line":2915},27,[1121,2917,1253],{},[1080,2919,2920],{},[1148,2921,2922],{},"Scenario 1 (visible):",[1080,2924,2925],{},[1148,2926,2927],{},"Input:",[1112,2929,2932],{"className":2930,"code":2931,"language":2775,"meta":1117},[2773],"FL_Current 12.5 FL_Current 12.5 3 Left\n",[1083,2933,2931],{"__ignoreMap":1117},[1080,2935,2936],{},[1148,2937,2938],{},"Expected output:",[1112,2940,2942],{"className":2941,"code":2774,"language":2775,"meta":1117},[2773],[1083,2943,2774],{"__ignoreMap":1117},[1080,2945,2946],{},[1148,2947,2948],{},"Scenario 2 (visible):",[1080,2950,2951],{},[1148,2952,2927],{},[1112,2954,2957],{"className":2955,"code":2956,"language":2775,"meta":1117},[2773],"FL_Current 12.5 FR_Current 12.5 0 Center\n",[1083,2958,2956],{"__ignoreMap":1117},[1080,2960,2961],{},[1148,2962,2938],{},[1112,2964,2967],{"className":2965,"code":2966,"language":2775,"meta":1117},[2773],"FL_Current -> 12.5\nfalse\n1 CENTER\n",[1083,2968,2966],{"__ignoreMap":1117},[1080,2970,2971],{},[1148,2972,2973],{},"Scenario 3 (hidden):",[1080,2975,2976],{},[1148,2977,2927],{},[1112,2979,2982],{"className":2980,"code":2981,"language":2775,"meta":1117},[2773],"Pitch 4.0 Pitch 4.5 9 Right\n",[1083,2983,2981],{"__ignoreMap":1117},[1080,2985,2986],{},[1148,2987,2938],{},[1112,2989,2992],{"className":2990,"code":2991,"language":2775,"meta":1117},[2773],"Pitch -> 4.0\nfalse\n10 RIGHT\n",[1083,2993,2991],{"__ignoreMap":1117},[1080,2995,2996],{},[1148,2997,2998],{},"Scenario 4 (hidden):",[1080,3000,3001],{},[1148,3002,2927],{},[1112,3004,3007],{"className":3005,"code":3006,"language":2775,"meta":1117},[2773],"BusVoltage 12.25 BusVoltage 12.25 -1 Front\n",[1083,3008,3006],{"__ignoreMap":1117},[1080,3010,3011],{},[1148,3012,2938],{},[1112,3014,3017],{"className":3015,"code":3016,"language":2775,"meta":1117},[2773],"BusVoltage -> 12.25\ntrue\n0 FRONT\n",[1083,3018,3016],{"__ignoreMap":1117},[1080,3020,3021],{},[1148,3022,3023],{},"Scenario 5 (hidden):",[1080,3025,3026],{},[1148,3027,2927],{},[1112,3029,3032],{"className":3030,"code":3031,"language":2775,"meta":1117},[2773],"Gyro 1000.5 Gyro 1000.5 41 Back\n",[1083,3033,3031],{"__ignoreMap":1117},[1080,3035,3036],{},[1148,3037,2938],{},[1112,3039,3042],{"className":3040,"code":3041,"language":2775,"meta":1117},[2773],"Gyro -> 1000.5\ntrue\n42 BACK\n",[1083,3043,3041],{"__ignoreMap":1117},[1080,3045,3046],{},[1148,3047,3048],{},"Solution:",[1112,3050,3052],{"className":1114,"code":3051,"language":1116,"meta":1117,"style":1117},"import java.util.*;\n\npublic class Main\n{\n    \u002F\u002F Don't change main\n    public static void main(String[] args)\n    {\n        Scanner in = new Scanner(System.in);\n        Pair\u003CString, Double> a = new Pair\u003C>(in.next(), in.nextDouble());\n        Pair\u003CString, Double> b = new Pair\u003C>(in.next(), in.nextDouble());\n        Pair\u003CInteger, String> slot = new Pair\u003C>(in.nextInt(), in.next());\n        System.out.println(a.getKey() + \" -> \" + a.getValue());\n        System.out.println(Util.sameEntry(a, b));\n        int nextId = slot.getKey() + 1;\n        System.out.println(nextId + \" \" + slot.getValue().toUpperCase());\n    }\n}\n\nclass Pair\u003CK, V>\n{\n    private K key;\n    private V value;\n\n    public Pair(K key, V value)\n    {\n        this.key = key;\n        this.value = value;\n    }\n\n    public K getKey() { return key; }\n    public V getValue() { return value; }\n}\n\nclass Util\n{\n    public static \u003CK, V> boolean sameEntry(Pair\u003CK, V> p1, Pair\u003CK, V> p2)\n    {\n        return p1.getKey().equals(p2.getKey()) && p1.getValue().equals(p2.getValue());\n    }\n}\n",[1083,3053,3054,3058,3062,3066,3070,3074,3078,3082,3086,3090,3094,3098,3102,3106,3110,3114,3118,3122,3126,3131,3135,3139,3143,3147,3151,3155,3159,3163,3168,3173,3179,3184,3189,3194,3199,3204,3209,3214,3219,3224],{"__ignoreMap":1117},[1121,3055,3056],{"class":1123,"line":1124},[1121,3057,2792],{},[1121,3059,3060],{"class":1123,"line":1130},[1121,3061,1235],{"emptyLinePlaceholder":1234},[1121,3063,3064],{"class":1123,"line":1136},[1121,3065,2801],{},[1121,3067,3068],{"class":1123,"line":1188},[1121,3069,1224],{},[1121,3071,3072],{"class":1123,"line":1238},[1121,3073,2810],{},[1121,3075,3076],{"class":1123,"line":1244},[1121,3077,2576],{},[1121,3079,3080],{"class":1123,"line":1250},[1121,3081,1363],{},[1121,3083,3084],{"class":1123,"line":1366},[1121,3085,2823],{},[1121,3087,3088],{"class":1123,"line":1372},[1121,3089,2828],{},[1121,3091,3092],{"class":1123,"line":1378},[1121,3093,2833],{},[1121,3095,3096],{"class":1123,"line":1384},[1121,3097,2838],{},[1121,3099,3100],{"class":1123,"line":1389},[1121,3101,2843],{},[1121,3103,3104],{"class":1123,"line":1395},[1121,3105,2848],{},[1121,3107,3108],{"class":1123,"line":1401},[1121,3109,2853],{},[1121,3111,3112],{"class":1123,"line":1406},[1121,3113,2858],{},[1121,3115,3116],{"class":1123,"line":1411},[1121,3117,1381],{},[1121,3119,3120],{"class":1123,"line":1979},[1121,3121,1253],{},[1121,3123,3124],{"class":1123,"line":1984},[1121,3125,1235],{"emptyLinePlaceholder":1234},[1121,3127,3128],{"class":1123,"line":1990},[1121,3129,3130],{},"class Pair\u003CK, V>\n",[1121,3132,3133],{"class":1123,"line":1996},[1121,3134,1224],{},[1121,3136,3137],{"class":1123,"line":2883},[1121,3138,1344],{},[1121,3140,3141],{"class":1123,"line":2888},[1121,3142,1349],{},[1121,3144,3145],{"class":1123,"line":2893},[1121,3146,1235],{"emptyLinePlaceholder":1234},[1121,3148,3149],{"class":1123,"line":2898},[1121,3150,1358],{},[1121,3152,3153],{"class":1123,"line":2904},[1121,3154,1363],{},[1121,3156,3157],{"class":1123,"line":2909},[1121,3158,1369],{},[1121,3160,3161],{"class":1123,"line":2915},[1121,3162,1375],{},[1121,3164,3166],{"class":1123,"line":3165},28,[1121,3167,1381],{},[1121,3169,3171],{"class":1123,"line":3170},29,[1121,3172,1235],{"emptyLinePlaceholder":1234},[1121,3174,3176],{"class":1123,"line":3175},30,[1121,3177,3178],{},"    public K getKey() { return key; }\n",[1121,3180,3182],{"class":1123,"line":3181},31,[1121,3183,1398],{},[1121,3185,3187],{"class":1123,"line":3186},32,[1121,3188,1253],{},[1121,3190,3192],{"class":1123,"line":3191},33,[1121,3193,1235],{"emptyLinePlaceholder":1234},[1121,3195,3197],{"class":1123,"line":3196},34,[1121,3198,2901],{},[1121,3200,3202],{"class":1123,"line":3201},35,[1121,3203,1224],{},[1121,3205,3207],{"class":1123,"line":3206},36,[1121,3208,1440],{},[1121,3210,3212],{"class":1123,"line":3211},37,[1121,3213,1363],{},[1121,3215,3217],{"class":1123,"line":3216},38,[1121,3218,1449],{},[1121,3220,3222],{"class":1123,"line":3221},39,[1121,3223,1381],{},[1121,3225,3227],{"class":1123,"line":3226},40,[1121,3228,1253],{},[1080,3230,3231,1667,3233,3236,3237,3240,3241,1788,3243,3245,3246,3248,3249,2215,3251,3254,3255,3258,3259,3262,3263,3266,3267,1206,3269,3271,3272,3274],{},[1148,3232,2367],{},[1083,3234,3235],{},"class Pair\u003CK, V>"," introduces the two type variables, and the fields, constructor\nparameters, and getter return types all use them. That is what lets ",[1083,3238,3239],{},"slot.getKey() + 1"," compile in\n",[1083,3242,2440],{},[1083,3244,2729],{}," returns an ",[1083,3247,1485],{}," there, not an ",[1083,3250,1109],{},[1083,3252,3253],{},"sameEntry"," declares its own\n",[1083,3256,3257],{},"\u003CK, V>"," right before the return type, and compares with ",[1083,3260,3261],{},".equals",", because ",[1083,3264,3265],{},"=="," on two separate\n",[1083,3268,1154],{},[1083,3270,1488],{}," objects compares references and would report ",[1083,3273,2755],{}," for two entries that\nread the same.",[1810,3276,1812],{},{"title":1117,"searchDepth":1130,"depth":1130,"links":3278},[3279,3280,3281],{"id":2304,"depth":1130,"text":2305},{"id":2426,"depth":1130,"text":2427},{"id":2688,"depth":1130,"text":2689},{"outlineRef":1826,"pairsWith":2291,"status":3283},"new — authored exercises (Multiple Choice + Micro-Parsons + Coding)",{"title":952,"description":1117},"oAKUpPDASmUozPGpI22XRFv6EELyzOT8mHD9UYiXpBQ",1792718166096]