English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutorial Básico de Java

Controle de Fluxo Java

Java Array

Java Orientação a Objetos (I)

Java Orientação a Objetos (II)

Java Orientação a Objetos (III)

Tratamento de Exceções Java

Java Lista (List)

Java Fila (Queue)

Java Conjunto de Mapas (Map)

Java Conjunto (Set)

Java Entrada e Saída (I/O)

Java Reader/Writer

Outros tópicos do Java

Java HashMap Methods Comprehensive

O Java possui muitos métodos HashMap, que nos permitem usar o HashMap. Nesta página de referência, você encontrará todos os métodos HashMap disponíveis no Java, bem como exemplos de uso de todos os métodos HashMap. Por exemplo, se precisar adicionar elementos ao hashmap, você pode usar o método put().

MétodoDescrição
clear()Remova todos os elementos do HashMap
clone()Gere uma cópia do HashMap
isEmpty()Verifique se o HashMap está vazio
size()Retorna o número de itens no HashMap
put()Insira o item especificado no HashMap
putAll()Insira todos os itens do mapeamento no HashMap
putIfAbsent()Se a chave não existir, insira o item
remove()Delete the mapping of the specified key
containsKey()Check if the specified key exists in the HashMap
containsValue()Check if the HashMap contains the specified value
replace()Replace the value of the specified key
replaceAll()Replace the value of all elements
get()Return the value using the specified key
getOrDefault()If the key is not found, return the specified default value
forEach()Perform an operation on all entries in the HashMap
entrySet()Return a view of all entries
keySet()Return a view of the set of all keys in the HashMap
values()Return a view of all existing values in the HashMap
merge()Merge the specified mapping into the HashMaps
compute()Calculate the new value for the specified key
computeIfAbsent()If there is no mapping for the key, calculate the value
computeIfPresent()If there is a key, calculate a value for the map