Source:
<code>public void put(List<Metric> metrics) { requireNotDisposed(); SystemAssert.requireArgument(metrics != null, "Metric list cannot be null."); List<Metric> metricsToPut = new ArrayList<>(metrics.size()); Set<String> scopesToPut = new HashSet<>(metrics.size()); Set<Pair<String, String>> scopesAndMetricsNamesToPut = new HashSet<>(metrics.size()); Map<String, MetatagsRecord> metatagsToPut = new HashMap<>(); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { String key = constructKey(metric, null); boolean found = bloomFilter.mightContain(key); if(!found) { metricsToPut.add(metric); } } else { boolean newTags = false; for(Entry<String, String> tagEntry : metric.getTags().entrySet()) { String key = constructKey(metric, tagEntry); boolean found = bloomFilter.mightContain(key); if(!found) { newTags = true; } } if(newTags) { metricsToPut.add(metric); } } String scopeName = metric.getScope(); String metricName = metric.getMetric(); String key = constructScopeOnlyKey(scopeName); boolean found = bloomFilterScopeOnly.mightContain(key); if(!found) { scopesToPut.add(scopeName); } key = constructScopeAndMetricOnlyKey(scopeName, metricName); found = bloomFilterScopeAndMetricOnly.mightContain(key); if(!found) { scopesAndMetricsNamesToPut.add(Pair.of(scopeName, metricName)); } MetatagsRecord mtags = metric.getMetatagsRecord(); if(mtags != null) { key = mtags.getKey(); <START> found = bloomFilterMetatags.mightContain(key); <END> if(!found) { metatagsToPut.put(key, mtags); } } } implementationSpecificPut(metricsToPut, scopesToPut, scopesAndMetricsNamesToPut, metatagsToPut); }</code><technical_language>Do need check key != null</technical_language>

Target:
public void put(List<Metric> metrics) { requireNotDisposed(); SystemAssert.requireArgument(metrics != null, "Metric list cannot be null."); List<Metric> metricsToPut = new ArrayList<>(metrics.size()); Set<String> scopesToPut = new HashSet<>(metrics.size()); Set<Pair<String, String>> scopesAndMetricsNamesToPut = new HashSet<>(metrics.size()); Map<String, MetatagsRecord> metatagsToPut = new HashMap<>(); for(Metric metric : metrics) { if(metric.getTags().isEmpty()) { String key = constructKey(metric, null); boolean found = bloomFilter.mightContain(key); if(!found) { metricsToPut.add(metric); } } else { boolean newTags = false; for(Entry<String, String> tagEntry : metric.getTags().entrySet()) { String key = constructKey(metric, tagEntry); boolean found = bloomFilter.mightContain(key); if(!found) { newTags = true; } } if(newTags) { metricsToPut.add(metric); } } String scopeName = metric.getScope(); String metricName = metric.getMetric(); String key = constructScopeOnlyKey(scopeName); boolean found = bloomFilterScopeOnly.mightContain(key); if(!found) { scopesToPut.add(scopeName); } key = constructScopeAndMetricOnlyKey(scopeName, metricName); found = bloomFilterScopeAndMetricOnly.mightContain(key); if(!found) { scopesAndMetricsNamesToPut.add(Pair.of(scopeName, metricName)); } MetatagsRecord mtags = metric.getMetatagsRecord(); if(mtags != null) { key = mtags.getKey(); if(key != null) { found = bloomFilterMetatags.mightContain(key); if(!found) { metatagsToPut.put(key, mtags); } } } } implementationSpecificPut(metricsToPut, scopesToPut, scopesAndMetricsNamesToPut, metatagsToPut); }