Skip to content

Instantly share code, notes, and snippets.

@kodaitakahashi
Created April 10, 2017 10:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kodaitakahashi/497be295d1827f34025860230b6485e6 to your computer and use it in GitHub Desktop.
Save kodaitakahashi/497be295d1827f34025860230b6485e6 to your computer and use it in GitHub Desktop.
hashMap mergeについて
import java.util.HashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ME {
public static void main(String[] args) {
HashMap<Integer, Integer> hashMap = new HashMap<Integer, Integer>();
hashMap.put(1, 100);
hashMap.put(2, 200);
hashMap.merge(1, 10, (a, b) -> a + b);
System.out.println(hashMap.get(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment