Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. list and map

list and map

Scheduled Pinned Locked Moved Java
question
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Swarnendu09
    wrote on last edited by
    #1

    on what criteria we will decide whether to use map or list?

    L 1 Reply Last reply
    0
    • S Swarnendu09

      on what criteria we will decide whether to use map or list?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It depends what you want to do with the information you are processing. The List[^] is just a simple list of values, whereas a Map[^] has keys to values for fast access.

      S R 2 Replies Last reply
      0
      • L Lost User

        It depends what you want to do with the information you are processing. The List[^] is just a simple list of values, whereas a Map[^] has keys to values for fast access.

        S Offline
        S Offline
        Swarnendu09
        wrote on last edited by
        #3

        i have one confusion that when we declare a list as below List lt = new Arraylist(); Then in that case what value it can store i.e same type of value or it is capable of storing any type of variables or objects.

        Jishnu

        L 1 Reply Last reply
        0
        • S Swarnendu09

          i have one confusion that when we declare a list as below List lt = new Arraylist(); Then in that case what value it can store i.e same type of value or it is capable of storing any type of variables or objects.

          Jishnu

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The List can store any type of object, but it does not make sense to store different types in the same list.

          1 Reply Last reply
          0
          • L Lost User

            It depends what you want to do with the information you are processing. The List[^] is just a simple list of values, whereas a Map[^] has keys to values for fast access.

            R Offline
            R Offline
            RohitS5
            wrote on last edited by
            #5

            Many things you need to know, 1) IF you store just one object, use List, if you have two object key and value use Map. 2) List is ordered, your objects will be stored in the order on which they are inserted, Map is not ordered, unless you use sorted ones. Source: See List vs Set vs Map

            L 1 Reply Last reply
            0
            • R RohitS5

              Many things you need to know, 1) IF you store just one object, use List, if you have two object key and value use Map. 2) List is ordered, your objects will be stored in the order on which they are inserted, Map is not ordered, unless you use sorted ones. Source: See List vs Set vs Map

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Why are you telling me this?

              Use the best guess

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups