0% found this document useful (0 votes)
6 views2 pages

Java Map Basics: Key-Value Operations

Uploaded by

balapaithara79
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Java Map Basics: Key-Value Operations

Uploaded by

balapaithara79
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Map<String, String> map = ...

for ([Link]<String, String> entry : [Link]()) {


[Link]([Link]() + "/" +
[Link]());
}

Map<String, Integer> map = new HashMap<>();


[Link]("one", 1);
[Link]("two", 2);
[Link]("three", 3);

for (String key : [Link]()) {


[Link]("Key: " + key + ", Value: " +
[Link](key));
}

public int size()


Returns the number of key-value mappings in this map.
public boolean containsKey(Object key)
Returns true if this map contains a mapping for the
specified key.
public boolean containsValue(Object value)

Page 1 of 2
Returns true if this map maps one or more keys to the
specified value.

Page 2 of 2

You might also like