Graphs { public static <E extends ConnectionData> void addPath(Graph<E> graph, Point... path) { for (int i = 1; i < path.length; i++) { graph.addConnection(path[i - 1], path[i]); } } private  Graphs(); static void addPath(Graph<E> graph,
      Point... path); static void addPath(Graph<E> graph,
      Iterable<Point> path); static void addBiPath(Graph<E> graph,
      Point... path); static void addBiPath(Graph<E> graph,
      Iterable<Point> path); static Graph<E> unmodifiableGraph(
      Graph<E> graph); static boolean equal(Graph<?> g1, @Nullable Object other); static List<Point> shortestPathEuclideanDistance(
      Graph<E> graph, final Point from, final Point to); static List<Point> shortestPath(
      Graph<E> graph, final Point from, final Point to, GeomHeuristic h); @Nullable static T findClosestObject(Point pos, Collection<T> objects,
      Function<T, Point> transformation); static List<T> findClosestObjects(Point pos,
      Collection<T> objects, Function<T, Point> transformation, int n); static double pathLength(List<Point> path); static ImmutableList<Point> getExtremes(Graph<?> graph);  }
@Test public void connectionOrder() { Point N, NE, E, SE, S, SW, W, NW; N = new Point(0, 5); NE = new Point(5, 5); E = new Point(5, 0); SE = new Point(5, -5); S = new Point(0, -5); SW = new Point(-5, -5); W = new Point(-5, 0); NW = new Point(-5, 5); Graphs.addPath(graph, N, NE, E, SE, S, SW, W, NW); final List<Point> points = Arrays.asList(N, NE, E, SE, S, SW, W, NW); final List<Connection<LengthData>> connections = newArrayList(graph .getConnections()); for (int i = 1; i < points.size(); i++) { assertSame(connections.get(i - 1).from(), points.get(i - 1)); assertSame(connections.get(i - 1).to(), points.get(i)); } }