How do you put the key number on Map?



  • We need to count the data from the Map file, whose key is the file line number, and the value is the text in the file line.

    The reference file is approximately:

    BMW  
    Lambo  
    Giguli  
    BLA  
    Lada  
    Car
    

    I can't figure out how to put the key number in Map!



  • Map<Integer,String> map = new HashMap<Integer,String>();
    
    map.put(nomer_stroki, sama_stroka);
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2