@Test public void testPointConversion() { MetricDimensions a = SnapshotConverter.convert(new Point(Collections.emptyMap())); MetricDimensions b = SnapshotConverter.convert(new Point(new HashMap<>(0))); MetricDimensions c = SnapshotConverter.convert((Point)null); assertEquals(a.hashCode(), b.hashCode()); assertEquals(a, b); assertEquals(a.hashCode(), c.hashCode()); assertEquals(a, c); assertEquals(b.hashCode(), c.hashCode()); assertEquals(b, c); }
static MetricDimensions convert(Point p) { if (p == null) { return StateMetricContext.newInstance(null); } List<String> dimensions = p.dimensions(); List<Value> location = p.location(); Map<String, Object> pointWrapper = new HashMap<>(dimensions.size()); for (int i = 0; i < dimensions.size(); ++i) { pointWrapper.put(dimensions.get(i), valueAsString(location.get(i))); } return StateMetricContext.newInstance(pointWrapper); }
SnapshotConverter { static MetricDimensions convert(Point p) { if (p == null) { return StateMetricContext.newInstance(null); } List<String> dimensions = p.dimensions(); List<Value> location = p.location(); Map<String, Object> pointWrapper = new HashMap<>(dimensions.size()); for (int i = 0; i < dimensions.size(); ++i) { pointWrapper.put(dimensions.get(i), valueAsString(location.get(i))); } return StateMetricContext.newInstance(pointWrapper); } }
SnapshotConverter { static MetricDimensions convert(Point p) { if (p == null) { return StateMetricContext.newInstance(null); } List<String> dimensions = p.dimensions(); List<Value> location = p.location(); Map<String, Object> pointWrapper = new HashMap<>(dimensions.size()); for (int i = 0; i < dimensions.size(); ++i) { pointWrapper.put(dimensions.get(i), valueAsString(location.get(i))); } return StateMetricContext.newInstance(pointWrapper); } SnapshotConverter(Bucket snapshot); }
SnapshotConverter { static MetricDimensions convert(Point p) { if (p == null) { return StateMetricContext.newInstance(null); } List<String> dimensions = p.dimensions(); List<Value> location = p.location(); Map<String, Object> pointWrapper = new HashMap<>(dimensions.size()); for (int i = 0; i < dimensions.size(); ++i) { pointWrapper.put(dimensions.get(i), valueAsString(location.get(i))); } return StateMetricContext.newInstance(pointWrapper); } SnapshotConverter(Bucket snapshot);  }
SnapshotConverter { static MetricDimensions convert(Point p) { if (p == null) { return StateMetricContext.newInstance(null); } List<String> dimensions = p.dimensions(); List<Value> location = p.location(); Map<String, Object> pointWrapper = new HashMap<>(dimensions.size()); for (int i = 0; i < dimensions.size(); ++i) { pointWrapper.put(dimensions.get(i), valueAsString(location.get(i))); } return StateMetricContext.newInstance(pointWrapper); } SnapshotConverter(Bucket snapshot);   }