LatitudeLongitudeHandler extends BaseKlvHandler implements Trimmable { @Override public void trim() { int minListSize = getMinimumListSize(); map.keySet() .forEach( key -> map.computeIfPresent( key, (fieldName, list) -> list.size() > minListSize ? list.subList(0, minListSize) : list)); } LatitudeLongitudeHandler(
      String attributeName, String latitudeFieldName, String longitudeFieldName); String getLongitudeFieldName(); String getLatitudeFieldName(); Map<String, List<Double>> getRawGeoData(); @Override Optional<Attribute> asAttribute(); LatitudeLongitudeHandler asSubsampledHandler(int subsampleCount); @Override void trim(); @Override void accept(KlvDataElement klvDataElement); @Override void reset(); void accept(String name, Double value);  }
@Test public void testTrim() throws KlvDecodingException { double lat = 1; double lon = 2; klvHandler.accept(KlvUtilities.createTestFloat(LAT, lat)); klvHandler.accept(KlvUtilities.createTestFloat(LON, lon)); klvHandler.accept(KlvUtilities.createTestFloat(LAT, 3)); klvHandler.trim(); Map<String, List<Double>> data = klvHandler.getRawGeoData(); assertThat(data.get(LAT), hasSize(1)); assertThat(data.get(LON), hasSize(1)); assertThat(data.get(LAT).get(0), is(closeTo(lat, EPSILON))); assertThat(data.get(LON).get(0), is(closeTo(lon, EPSILON))); }