### Question:
SpectatorRequestMetricCollector extends RequestMetricCollector { static <R> Optional<R> firstValue(List<Object> properties, Function<Object, R> transform) { return notEmpty(properties).map(v -> v.get(0)).map(transform::apply); } SpectatorRequestMetricCollector(Registry registry);  SpectatorRequestMetricCollector(Registry registry, Map<String, String> customTags); @Override void collectMetrics(Request<?> request, Response<?> response);  }### Answer:
@Test public void testListFiltering() { assertEquals(Optional.empty(), SpectatorRequestMetricCollector.firstValue(null, Object::toString)); assertEquals(Optional.empty(), SpectatorRequestMetricCollector.firstValue(Collections.emptyList(), Object::toString)); assertEquals(Optional.of("1"), SpectatorRequestMetricCollector.firstValue(Collections.singletonList(1L), Object::toString)); assertEquals(Optional.empty(), SpectatorRequestMetricCollector.firstValue(Collections.singletonList(null), Object::toString)); }