how I delete the keys and the equal {=} that the hasmap creates when I compile the code

1

when using collections in java I have this problem when compiling the code create me these keys and the sign of the same and inside add the code {=} as I delete those keys and that sign of the same

    HashMap valor = new HashMap();

    valor.put(h,"html");

    System.out.println(valor);

the result thrown by the console is {= html} and I do not want it to come out so I need the code to come out clean only html without the keys or the sign of the same I hope you can help me thanks

    
asked by Jhon Oneall 12.07.2018 в 03:08
source

1 answer

1

You can do it in the following way using the .get() method to get only the value by passing the key as an argument.

HashMap<Integer, String> valor = new HashMap<Integer, String>();

        valor.put(1,"html");

        System.out.println(valor.get(1));

Result:

  

html

    
answered by 12.07.2018 / 03:26
source