{"id":18364583,"url":"https://github.com/mukul273/java-collections","last_synced_at":"2026-05-09T09:48:54.342Z","repository":{"id":177639545,"uuid":"85378122","full_name":"mukul273/Java-Collections","owner":"mukul273","description":"Java Collections for beginners","archived":false,"fork":false,"pushed_at":"2017-03-21T19:43:18.000Z","size":1189,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-15T19:49:07.342Z","etag":null,"topics":["collections","git","github","java"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mukul273.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-18T05:29:10.000Z","updated_at":"2018-07-19T20:33:47.000Z","dependencies_parsed_at":null,"dependency_job_id":"c2701844-884e-4dc1-a7b7-fef54223073e","html_url":"https://github.com/mukul273/Java-Collections","commit_stats":null,"previous_names":["mukul273/java-collections"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukul273%2FJava-Collections","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukul273%2FJava-Collections/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukul273%2FJava-Collections/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mukul273%2FJava-Collections/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mukul273","download_url":"https://codeload.github.com/mukul273/Java-Collections/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248198886,"owners_count":21063628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collections","git","github","java"],"created_at":"2024-11-05T23:10:58.024Z","updated_at":"2026-05-09T09:48:49.291Z","avatar_url":"https://github.com/mukul273.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is for Basic understanding of Java Collections Framework.\r\n\r\n/* \r\n         * Consider:\r\n         * 1. what you need the collection to do\r\n         * 2. are you using the fastest collection for your purposes\r\n         * (think about insertion/deletion, retrieval and traversal\r\n         */\r\n         \r\n        //////////////// LISTS ///////////////////////////////////\r\n         \r\n        // Store lists of objects\r\n        // Duplicates are allowed\r\n        // Objects remain in order\r\n        // Elements are indexed via an integer\r\n        // cf. shopping list\r\n        // Checking for particular item in list is slow\r\n        // Looking an item up by index is fast\r\n        // Iterating through lists is relatively fast\r\n        // Note: you can sort lists if you want to.\r\n         \r\n        // If you only add or remove items at end of list, use ArrayList.\r\n        List\u003cString\u003e list1 = new ArrayList\u003cString\u003e();\r\n         \r\n        // Removing or adding items elsewhere in the list?\r\n        List\u003cString\u003e list2 = new LinkedList\u003cString\u003e();\r\n         \r\n        ////////////////SETS ///////////////////////////////////\r\n         \r\n        // Only store unique values\r\n        // Great for removing duplicates\r\n        // Not indexed, unlike lists\r\n        // Very fast to check if a particular object exists\r\n        // If you want to use your own objects, you must implement hashCode() and equals().\r\n         \r\n        // Order is unimportant and OK if it changes?\r\n        // HashSet is not ordered.\r\n        Set\u003cString\u003e set1 = new HashSet\u003cString\u003e();\r\n         \r\n        // Sorted in natural order? Use TreeSet - must implement Comparable for custom types\r\n        // (1,2,3 ..., a,b,c.... etc)\r\n        Set\u003cString\u003e set2 = new TreeSet\u003cString\u003e();\r\n         \r\n        // Elements remain in order they were added\r\n        Set\u003cString\u003e set3 = new LinkedHashSet\u003cString\u003e();\r\n         \r\n        ////////////////MAPS ///////////////////////////////////\r\n         \r\n        // Key value pairs.\r\n        // Like lookup tables\r\n        // Retrieving a value by key is fast\r\n        // Iterating over map values is very slow\r\n        // Maps not really optimised for iteration\r\n        // If you want to use your own objects as keys, you must implement hashCode() and equals().\r\n         \r\n        // Keys not in any particular order, and order liable to change.\r\n        Map\u003cString, String\u003e map1 = new HashMap\u003cString, String\u003e();\r\n         \r\n        // Keys sorted in natural order - must implement Comparable for custom types\r\n        Map\u003cString, String\u003e map2 = new TreeMap\u003cString, String\u003e();\r\n         \r\n        // Keys remain in order added \r\n        Map\u003cString, String\u003e map3 = new LinkedHashMap\u003cString, String\u003e();\r\n         \r\n        // There are also the SortedSet and SortedMap interfaces.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukul273%2Fjava-collections","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmukul273%2Fjava-collections","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmukul273%2Fjava-collections/lists"}