Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

hashmap in java

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HashhMap {
    public static void main(String[] args){
        Map<String, String> map = new HashMap<>();
        map.put("myName","Kumaran");
        map.put("myProgram", "Java");
        map.put("Designation", "Java Developer");

        Set<String> key = map.keySet();


        for(String keys: key){
            System.out.println(keys+ " : "  +map.get(keys));
        }
    }
}
Comment

HashMap java

package org.o7planning.tutorial.javacollection.helloworld;

import java.util.HashMap;

public class HelloHashMap {

	public static void main(String[] args) {

		// Créer un objet HashMap qui stocke les paires des ID d'employés et des salaires.
		// Clé de chaîne: ID d'employé
		// Valeur flottante: Salaire.
		HashMap<String, Float> salaryMap = new HashMap<String, Float>();
	 

		salaryMap.put("E01", 1000f);
		salaryMap.put("E02", 12000f);
		salaryMap.put("E03", 12300f);
		salaryMap.put("E04", 1000f);
		salaryMap.put("E05", 300.5f);
		
		// Obtenir les salaires des employés 'E02'
		Float salary= salaryMap.get("E01");
		System.out.println("Salary of employee E01 = "+ salary);
		
		// Mettre à jour le salaire pour les employés 'E05'
		salaryMap.put("E05", 400f);
		
		System.out.println("Salary of employee E05 = "+ salaryMap.get("E05"));
		 
	}

}
Comment

hashmap java

    private static final Map<Integer, String> map = Map.of(
        1, "one",
        2, "two"
    );
Comment

Java HashMap

import java.util.HashMap; // import the HashMap class

HashMap<String, String> capitalCities = new HashMap<String, String>();
Comment

PREVIOUS NEXT
Code Example
Java :: zweidimensionales array ausgeben java 
Java :: javafx get the controller of a pane 
Java :: java check if property exists in class 
Java :: print 1 to 10 using thread in java 
Java :: list.of java 
Java :: how to use ListIterator in java 
Java :: even and odd java & 
Java :: -3 to string in java 
Java :: smart ways to print a matrix in java 
Java :: reversing the linked list 
Java :: string palindrome in java 
Java :: java sort a map by keys 
Java :: convert Date to LocalDate via Instant 
Java :: Java Create a BufferedWriter 
Java :: index of an array procesing 
Java :: unchecked exception in java 
Java :: remove all element in a list java 
Java :: Float to bytes java 
Java :: regex s+ 
Java :: combinations in java 
Java :: get role assigned to a user inside spring controller 
Java :: intelilj javadoc: error - Malformed locale name: UTF8 
Java :: pop back stack fragment android 
Java :: declaring variables views in java android 
Java :: android text change java debounce 
Java :: java show my form 
Java :: java lamda 
Java :: add close button on right top corner of alert dialog box for android 
Java :: java bogo sort 
Java :: how to add data into list model in android 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =