### Question:
PointList implements Iterable<GHPoint3D>, PointAccess { public void reverse() { ensureMutability(); int max = size / 2; for (int i = 0; i < max; i++) { int swapIndex = size - i - 1; double tmp = latitudes[i]; latitudes[i] = latitudes[swapIndex]; latitudes[swapIndex] = tmp; tmp = longitudes[i]; longitudes[i] = longitudes[swapIndex]; longitudes[swapIndex] = tmp; if (is3D) { tmp = elevations[i]; elevations[i] = elevations[swapIndex]; elevations[swapIndex] = tmp; } } } PointList();  PointList(int cap, boolean is3D); @Override boolean is3D(); @Override int getDimension(); @Override void ensureNode(int nodeId); @Override void setNode(int nodeId, double lat, double lon); @Override void setNode(int nodeId, double lat, double lon, double ele); void set(int index, double lat, double lon, double ele); void add(double lat, double lon); void add(double lat, double lon, double ele); void add(PointAccess nodeAccess, int index); void add(GHPoint point); void add(PointList points); void removeLastPoint(); int size(); int getSize(); boolean isEmpty(); @Override double getLat(int index); @Override double getLatitude(int index); @Override double getLon(int index); @Override double getLongitude(int index); @Override double getElevation(int index); void setElevation(int index, double ele); @Override double getEle(int index); void reverse(); void clear(); void trimToSize(int newSize); @Override String toString(); static PointList fromLineString(LineString lineString); LineString toLineString(boolean includeElevation); LineString getCachedLineString(boolean includeElevation); @Override boolean equals(Object obj); static boolean equalsEps(double d1, double d2); static boolean equalsEps(double d1, double d2, double epsilon); PointList clone(boolean reverse); PointList copy(int from, int end); PointList shallowCopy(final int from, final int end, boolean makeImmutable); @Override int hashCode(); double calcDistance(DistanceCalc calc); void parse2DJSON(String str); GHPoint3D get(int index); @Override Iterator<GHPoint3D> iterator(); static PointList from(LineString lineString); boolean isImmutable(); PointList makeImmutable(); static final PointList EMPTY; }### Answer:
@Test public void testReverse() { PointList instance = new PointList(); instance.add(1, 1); instance.reverse(); assertEquals(1, instance.getLongitude(0), 1e-7); instance = new PointList(); instance.add(1, 1); instance.add(2, 2); PointList clonedList = instance.clone(false); instance.reverse(); assertEquals(2, instance.getLongitude(0), 1e-7); assertEquals(1, instance.getLongitude(1), 1e-7); assertEquals(clonedList, instance.clone(true)); }