### Question:
Bounds extends Envelope { public static <T extends Envelope> Iterable<T> tile(final T env, double resx, double resy, final T reuse) { final double dx = env.getWidth() * resx; final double dy = env.getHeight() * resy; return new Iterable<T>() { @Override public Iterator<T> iterator() { return new Iterator<T>() { double x = env.getMinX(); double y = env.getMinY(); @Override public boolean hasNext() { return x < env.getMaxX() && y < env.getMaxY(); } @Override public T next() { T b = reuse != null ? reuse : (T) new Bounds(); b.init(x, Math.min(x+dx, env.getMaxX()), y, Math.min(y+dy, env.getMaxY())); x += dx; if (x >= env.getMaxX()) { x = env.getMinX(); y += dy; } return b; } @Override public void remove() { throw new UnsupportedOperationException(); } }; } }; } Bounds();  Bounds(Envelope env);  Bounds(double west, double east, double south, double north); static Bounds scale(Envelope env, double scale); static Bounds scale(Envelope env, double scale, Coordinate focus); static Bounds expand(Envelope env, double x, double y); static Bounds square(Envelope env); static List<Coordinate> corners(Envelope env); static Iterable<T> tile(final T env, double resx, double resy, final T reuse); static Bounds translate(Envelope env, double dx, double dy); static Polygon toPolygon(Envelope e); static boolean isNull(Envelope e); static String toString(Envelope e); static String toString(Envelope e, String delim, boolean alt); static Bounds parse(String str); static Bounds parse(String str, boolean alt); static Bounds parse(String str, boolean alt, String delim); static Envelope flip(Envelope e); static Envelope random(Envelope bbox, float res); static List<Envelope> randoms(Envelope bbox, float minRes, float maxRes, int n); double west(); double south(); double east(); double north(); double width(); double height(); Bounds scale(double factor); Bounds expand(double amt); Bounds expand(double x, double y); Bounds square(); Bounds shift(double dx, double dy); List<Coordinate> corners(); Iterable<Bounds> tile(double resx, double resy); Polygon polygon(); @Override Bounds intersection(Envelope env); @Override String toString(); static final Bounds WORLD_BOUNDS_4326; }### Answer:
@Test public void testTile() { Envelope e = new Envelope(-180,180,-90,90); Iterator<Envelope> t = Bounds.tile(e, 0.5, 0.5, null).iterator(); assertTrue(t.hasNext()); assertEquals(new Envelope(-180,0,-90,0), t.next()); assertTrue(t.hasNext()); assertEquals(new Envelope(0,180,-90,0), t.next()); assertTrue(t.hasNext()); assertEquals(new Envelope(-180,0,0,90), t.next()); assertTrue(t.hasNext()); assertEquals(new Envelope(0,180,0,90), t.next()); assertFalse(t.hasNext()); }