Geomem { public Iterable<Info<T, R>> find(double topLeftLat, double topLeftLon, double bottomRightLat, double bottomRightLon, long start, long finish) { Coverage cover = GeoHash.coverBoundingBox(topLeftLat, topLeftLon, bottomRightLat, bottomRightLon); Iterable<Info<T, R>> it = Collections.emptyList(); for (String hash : cover.getHashes()) { it = Iterables.concat(it, find(topLeftLat, topLeftLon, bottomRightLat, bottomRightLon, start, finish, hash)); } return it; }  Iterable<Info<T, R>> find(double topLeftLat, double topLeftLon, double bottomRightLat,
            double bottomRightLon, long start, long finish); @SuppressWarnings("unchecked") void add(double lat, double lon, long time, T t); void add(double lat, double lon, long time, T t, R id); void add(double lat, double lon, long time, T t, Optional<R> id); void add(Info<T, R> info);  }
@Test public void testGeomemFindWhenNoData() { Geomem<String, String> g = new Geomem<String, String>(); g.find(topLeftLat, topLeftLong, bottomRightLat, bottomRightLong, 0, 1000); }
@Test public void testGeomemManyEntries() throws InterruptedException { System.out.println("maxMemory=" + Runtime.getRuntime().maxMemory() / 1048576 + "MB"); Geomem<String, String> g = new Geomem<String, String>(); System.gc(); Thread.sleep(100); reportMemoryUsage(); for (int i = 0; i < 10000; i++) { if (i % 1000 == 0) { System.out.println("count=" + i); reportMemoryUsage(); } addRandomEntry(g); } reportMemoryUsage(); System.gc(); Thread.sleep(100); reportMemoryUsage(); List<Info<String, String>> list = Lists.newArrayList(g.find(topLeftLat, topLeftLong, bottomRightLat, bottomRightLong, 0, 1000)); System.out.println(list.size()); }