@Test public void testRouteSimilarity3() { String[] urls = new String[]{ "navigation/view2", "navigation2/view1", "navigation/view1", "navigation/view4", "navigation/view5", "navigation/view6", "navigation/view7", "navigation/view8", "navigation/view9", "navigation", }; String currentRoutePart = "navigation/view1"; RouteSimilarity r = Arrays.stream(urls) .map(s -> new RouteSimilarity(currentRoutePart, s)) .max(Comparator.comparingInt(RouteSimilarity::getSimilarity)).get(); String result1 = r.getRouteString(); String result2 = urls[2]; Assert.assertEquals(result1, result2); }
public String getRouteString() { return routeString; }
RouteSimilarity { public String getRouteString() { return routeString; } }
RouteSimilarity { public String getRouteString() { return routeString; } RouteSimilarity(RouteData routeData, String currentRoute);  RouteSimilarity(String url, String currentRouteParts); }
RouteSimilarity { public String getRouteString() { return routeString; } RouteSimilarity(RouteData routeData, String currentRoute);  RouteSimilarity(String url, String currentRouteParts); RouteData getRouteData(); Class<? extends Component> getRoute(); String getRouteString(); int getSimilarity(); }
RouteSimilarity { public String getRouteString() { return routeString; } RouteSimilarity(RouteData routeData, String currentRoute);  RouteSimilarity(String url, String currentRouteParts); RouteData getRouteData(); Class<? extends Component> getRoute(); String getRouteString(); int getSimilarity();  }