Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

In Java, how will you decide when to use a List, Set or a Map collection

Pragya Keshap answered on February 4, 2023 Popularity 5/10 Helpfulness 4/10

Contents


More Related Answers

  • convert list to map java
  • map string list string in java
  • create map java
  • NodeList map
  • java map keyset to list
  • java map to list or array
  • print list of map java
  • java map to list or array
  • map list to hashmap java8
  • java create map
  • list to map of list java 8
  • java map create with values
  • java map declaration
  • java map to arraylist
  • map in java
  • java map entry
  • return map entry java
  • Java How to use Map?
  • java map key set
  • return map entry java
  • What is the difference between a Set and a Map in Java?
  • how to get a set from a map in java
  • Syntax of Creating Java Map Objects
  • create map java
  • how to instanciate map.entry java
  • Where do you use Set, HashMap, List in your framework?
  • how to get map with string as key and Arraylist as value in java
  • Implementation of HashMap Class in Java map
  • What are the differences between a List and Set collection in Java?

  • In Java, how will you decide when to use a List, Set or a Map collection

    0

     If we want a Collection that does not store duplicate

    values, then we use a Set based collection.

    2. If we want to frequently access elements operations based

    on an index value then we use a List based collection. E.g.

    ArrayList

    3. If we want to maintain the insertion order of elements in a

    collection then we use a List based collection.

    4. For fast search operation based on a key, value pair, we

    use a HashMap based collection.

    5. If we want to maintain the elements in a sorted order, then

    we use a TreeSet based collection.

    https://www.w3schools.blog/list-set-map-java

    Popularity 5/10 Helpfulness 4/10 Language java
    Source: Grepper
    Tags: java map set when
    Link to this answer
    Share Copy Link
    Contributed on Feb 04 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.