8000 Java-Coding-Problems/Chapter02 at master · rag7nayak/Java-Coding-Problems · GitHub
[go: up one dir, main page]

Skip to content
{"payload":{"allShortcutsEnabled":false,"path":"Chapter02","repo":{"id":769451618,"defaultBranch":"master","name":"Java-Coding-Problems","ownerLogin":"rag7nayak","currentUserCanPush":false,"isFork":true,"isEmpty":false,"createdAt":"2024-03-09T05:35:46.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/41148504?v=4","public":true,"private":false,"isOrgOwned":false},"currentUser":null,"refInfo":{"name":"master","listCacheKey":"v0:1709962552.830115","canEdit":false,"refType":"branch","currentOid":"dffaf0da5b17d2390a40482a6378f1eb9bc2318c"},"tree":{"items":[{"name":"BONUS_1_SpringAndJavaRecords","path":"Chapter02/BONUS_1_SpringAndJavaRecords","contentType":"directory"},{"name":"BONUS_2_SpringAndJavaRecordsInjection","path":"Chapter02/BONUS_2_SpringAndJavaRecordsInjection","contentType":"directory"},{"name":"P40_CheckNullsFunctionalNonFunctional","path":"Chapter02/P40_CheckNullsFunctionalNonFunctional","contentType":"directory"},{"name":"P41_NullThenThrowCustomNpe","path":"Chapter02/P41_NullThenThrowCustomNpe","contentType":"directory"},{"name":"P42_NullThrowSpecifiedException","path":"Chapter02/P42_NullThrowSpecifiedException","contentType":"directory"},{"name":"P43_NullReturnNonNullDefault","path":"Chapter02/P43_NullReturnNonNullDefault","contentType":"directory"},{"name":"P44_CheckIndexBetweenZeroLength","path":"Chapter02/P44_CheckIndexBetweenZeroLength","contentType":"directory"},{"name":"P45_CheckSubRangeInZeroLength","path":"Chapter02/P45_CheckSubRangeInZeroLength","contentType":"directory"},{"name":"P46_EqualsHashCode","path":"Chapter02/P46_EqualsHashCode","contentType":"directory"},{"name":"P46_ViolateEqualsViaSymmetry","path":"Chapter02/P46_ViolateEqualsViaSymmetry","contentType":"directory"},{"name":"P48_ImmutableString","path":"Chapter02/P48_ImmutableString","contentType":"directory"},{"name":"P49_ImmutableClass","path":"Chapter02/P49_ImmutableClass","contentType":"directory"},{"name":"P50_PassReturnMutablesToImmutableClass","path":"Chapter02/P50_PassReturnMutablesToImmutableClass","contentType":"directory"},{"name":"P51_ImmutableBuilder","path":"Chapter02/P51_ImmutableBuilder","contentType":"directory"},{"name":"P52_BadDataInImmutable","path":"Chapter02/P52_BadDataInImmutable","contentType":"directory"},{"name":"P53_CloningObjects","path":"Chapter02/P53_CloningObjects","contentType":"directory"},{"name":"P54_OverrideString","path":"Chapter02/P54_OverrideString","contentType":"directory"},{"name":"P55_JDK13_SwitchExpression","path":"Chapter02/P55_JDK13_SwitchExpression","contentType":"directory"},{"name":"P55_SwitchExpression","path":"Chapter02/P55_SwitchExpression","contentType":"directory"},{"name":"P56_MultipleCaseLabels","path":"Chapter02/P56_MultipleCaseLabels","contentType":"directory"},{"name":"P57_JDK13_StatementBlocks","path":"Chapter02/P57_JDK13_StatementBlocks","contentType":"directory"},{"name":"P57_StatementBlocks","path":"Chapter02/P57_StatementBlocks","contentType":"directory"},{"name":".gitignore","path":"Chapter02/.gitignore","contentType":"file"},{"name":"README.md","path":"Chapter02/README.md","contentType":"file"}],"templateDirectorySuggestionUrl":null,"readme":{"displayName":"README.md","richText":"\u003carticle class=\"markdown-body entry-content container-lg\" itemprop=\"text\"\u003e\u003cdiv class=\"markdown-heading\" dir=\"auto\"\u003e\u003ch1 tabindex=\"-1\" class=\"heading-element\" dir=\"auto\"\u003eObjects, immutability and switch expressions\u003c/h1\u003e\u003ca id=\"user-content-objects-immutability-and-switch-expressions\" class=\"anchor\" aria-label=\"Permalink: Objects, immutability and switch expressions\" href=\"#objects-immutability-and-switch-expressions\"\u003e\u003csvg class=\"octicon octicon-link\" viewBox=\"0 0 16 16\" version=\"1.1\" width=\"16\" height=\"16\" aria-hidden=\"true\"\u003e\u003cpath d=\"m7.775 3.275 1.25-1.25a3.5 3.5 0 1 1 4.95 4.95l-2.5 2.5a3.5 3.5 0 0 1-4.95 0 .751.751 0 0 1 .018-1.042.751.751 0 0 1 1.042-.018 1.998 1.998 0 0 0 2.83 0l2.5-2.5a2.002 2.002 0 0 0-2.83-2.83l-1.25 1.25a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042Zm-4.69 9.64a1.998 1.998 0 0 0 2.83 0l1.25-1.25a.751.751 0 0 1 1.042.018.751.751 0 0 1 .018 1.042l-1.25 1.25a3.5 3.5 0 1 1-4.95-4.95l2.5-2.5a3.5 3.5 0 0 1 4.95 0 .751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018 1.998 1.998 0 0 0-2.83 0l-2.5 2.5a1.998 1.998 0 0 0 0 2.83Z\"\u003e\u003c/path\u003e\u003c/svg\u003e\u003c/a\u003e\u003c/div\u003e\n\u003cp dir=\"auto\"\u003eThis chapter includes 18 problems that involves objects, immutability and switch expressions. The chapter starts with several problems about dealing with null references. It continues with problems regarding checking indexes, \u003cstrong\u003eequals()\u003c/strong\u003e and \u003cstrong\u003ehashCode()\u003c/strong\u003e, and immutability (e.g., writing immutable classes, passing/returning mutable objects from immutable classes). The last part of the chapter deals with cloning objects and JDK 12 switch expressions.\u003c/p\u003e\n\u003c/article\u003e","errorMessage":null,"headerInfo":{"toc":[{"level":1,"text":"Objects, immutability and switch expressions","anchor":"objects-immutability-and-switch-expressions","htmlText":"Objects, immutability and switch expressions"}],"siteNavLoginPath":"/login?return_to=https%3A%2F%2Fgithub.com%2Frag7nayak%2FJava-Coding-Problems%2Ftree%2Fmaster%2FChapter02"}},"totalCount":24,"showBranchInfobar":true},"fileTree":{"":{"items":[{"name":"Chapter01","path":"Chapter01","contentType":"directory"},{"name":"Chapter02","path":"Chapter02","contentType":"directory"},{"name":"Chapter03","path":"Chapter03","contentType":"directory"},{"name":"Chapter04","path":"Chapter04","contentType":"directory"},{"name":"Chapter05","path":"Chapter05","contentType":"directory"},{"name":"Chapter06","path":"Chapter06","contentType":"directory"},{"name":"Chapter07","path":"Chapter07","contentType":"directory"},{"name":"Chapter08","path":"Chapter08","contentType":"directory"},{"name":"Chapter09","path":"Chapter09","contentType":"directory"},{"name":"Chapter10","path":"Chapter10","contentType":"directory"},{"name":"Chapter11","path":"Chapter11","contentType":"directory"},{"name":"Chapter12","path":"Chapter12","contentType":"directory"},{"name":"Chapter13","path":"Chapter13","contentType":"directory"},{"name":".gitignore","path":".gitignore","contentType":"file"},{"name":"LICENSE","path":"LICENSE","contentType":"file"},{"name":"README.md","path":"README.md","contentType":"file"}],"totalCount":16}},"fileTreeProcessingTime":7.36969,"foldersToFetch":[],"treeExpanded":true,"symbolsExpanded":false,"csrf_tokens":{"/rag7nayak/Java-Coding-Problems/branches":{"post":"E0gLAuZYQQJ9RuyKOsci8QzZGBMu1xt6HUAFpjujtm5UugSTzdzXdsH3ickl80lgX5AC3hs3cymdr7cuLW4v5Q"},"/rag7nayak/Java-Coding-Problems/branches/fetch_and_merge/master":{"post":"sYEKopD4uhc9iE9gQ23GhljN3z0sIS6l_sf2yZ_tgl944dAYQhJA3GvYvZV8wj-fBy5U-yaAfUOALJvVxyomPA"},"/rag7nayak/Java-Coding-Problems/branches/fetch_and_merge/master?discard_changes=true":{"post":"5SvxBLNz7EecLJGms6qbeP9C21DBTdfz71RgLpABbMUsSyu-YZkWjMp8Y1OMBWJhoKFQlsvshBWRvw0yyMbIpg"}}},"title":"Java-Coding-Problems/Chapter02 at master · rag7nayak/Java-Coding-Problems","appPayload":{"helpUrl":"https://docs.github.com","findFileWorkerPath":"/assets-cdn/worker/find-file-worker-7d7eb7c71814.js","findInFileWorkerPath":"/assets-cdn/worker/find-in-file-worker-1ae9fa256942.js","githubDevUrl":null,"enabled_features":{"code_nav_ui_events":false,"react_blob_overlay":false,"accessible_code_button":true,"github_models_repo_integration":false}}}
0