<commit_before>package org.psjava.ds.map;

import java.util.Iterator;

import org.psjava.javautil.AssertStatus;
import org.psjava.javautil.ConvertedDataIterator;
import org.psjava.javautil.DataConverter;
import org.psjava.javautil.EqualityTester;
import org.psjava.javautil.StrictEqualityTester;
import org.psjava.math.PairHash;


public class MutableMapUsingJavaMap {
	
	public static <K, V> MutableMap<K, V> create(final java.util.Map<K, V> map) {
		return new MutableMap<K, V>() {

			@Override
			public boolean containsKey(K key) {
				return map.containsKey(key);
			}

			@Override
			public V get(K key) {
				V r = map.get(key);
				AssertStatus.assertTrue(r != null, "key is not in map");
				return r;
			}

			@Override
			public V get(K key, V def) {
				V r = map.get(key);
				if (r != null)
					return r;
				else
					return def;
			}
<commit_msg>add assertion<commit_after>package org.psjava.ds.map;

import java.util.Iterator;

import org.psjava.javautil.AssertStatus;
import org.psjava.javautil.ConvertedDataIterator;
import org.psjava.javautil.DataConverter;
import org.psjava.javautil.EqualityTester;
import org.psjava.javautil.StrictEqualityTester;
import org.psjava.math.PairHash;


public class MutableMapUsingJavaMap {
	
	public static <K, V> MutableMap<K, V> create(final java.util.Map<K, V> map) {
		return new MutableMap<K, V>() {

			@Override
			public boolean containsKey(K key) {
				return map.containsKey(key);
			}

			@Override
			public V get(K key) {
				AssertStatus.assertTrue(containsKey(key));
				return map.get(key);
			}

			@Override
			public V get(K key, V def) {
				if (!containsKey(key))
					return def;
				return map.get(key);
			}

{'fraction_non_alphanumeric': 0.11611374407582939, 'fraction_numerical': 0.0, 'mean_word_length': 3.7047353760445683, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3313303', 'n_tokens_mistral': 693, 'n_tokens_neox': 595, 'n_words': 137}