public static <T, V> Pair<T, V> of(T t, V v) { return new Pair<T, V>(t, v); } }
private void processEntry(Map.Entry<MetricName, Metric> entry) { try { MetricName metricName = entry.getKey(); Metric metric = entry.getValue(); if (metricTranslator != null) { Pair<MetricName, Metric> pair = metricTranslator.apply(Pair.of(metricName, metric)); if (pair == null) return; metricName = pair._1; metric = pair._2; } metric.processWith(socketMetricProcessor, metricName, null); metricsGeneratedLastPass.incrementAndGet(); } catch (Exception e) { throw new RuntimeException(e); } } }
Metric value = subEntry.getValue(); if (metricTranslator != null) { Pair<MetricName, Metric> pair = metricTranslator.apply(Pair.of(key, value)); if (pair == null) continue; key = pair._1;
Metric value = subEntry.getValue(); if (metricTranslator != null) { Pair<MetricName, Metric> pair = metricTranslator.apply(Pair.of(key, value)); if (pair == null) continue; key = pair._1;
public static <T, V> Pair<T, V> of(T t, V v) { return new Pair<T, V>(t, v); } }
private static Pair<String, String>[] makeTags(String... tagAndValues) { Preconditions.checkArgument((tagAndValues.length & 1) == 0, "must have even number of tag values"); @SuppressWarnings("unchecked") Pair<String, String>[] toReturn = new Pair[tagAndValues.length / 2]; for (int i = 0; i < tagAndValues.length; i += 2) { String tag = tagAndValues[i]; String value = tagAndValues[i + 1]; if (tag != null && value != null) { toReturn[i / 2] = new Pair<String, String>(tag, value); } } return toReturn; }
private static Pair<String, String>[] makeTags(String... tagAndValues) { Preconditions.checkArgument((tagAndValues.length & 1) == 0, "must have even number of tag values"); @SuppressWarnings("unchecked") Pair<String, String>[] toReturn = new Pair[tagAndValues.length / 2]; for (int i = 0; i < tagAndValues.length; i += 2) { String tag = tagAndValues[i]; String value = tagAndValues[i + 1]; if (tag != null && value != null) { toReturn[i / 2] = new Pair<String, String>(tag, value); } } return toReturn; }
private static Pair<String, String>[] makeTags(Map<String, String> tags) { @SuppressWarnings("unchecked") Pair<String, String>[] toReturn = new Pair[tags.size()]; int i = 0; for (Map.Entry<String, String> entry : tags.entrySet()) { toReturn[i] = new Pair<String, String>(entry.getKey(), entry.getValue()); i++; } return toReturn; }
private static Pair<String, String>[] makeTags(Map<String, String> tags) { @SuppressWarnings("unchecked") Pair<String, String>[] toReturn = new Pair[tags.size()]; int i = 0; for (Map.Entry<String, String> entry : tags.entrySet()) { toReturn[i] = new Pair<String, String>(entry.getKey(), entry.getValue()); i++; } return toReturn; }