@Test public void sortByOrder() throws Exception { Map<String, CEKHandlerInterceptor> handlerInterceptorMap = new HashMap<>(); handlerInterceptorMap.put("a", new InterceptorA()); handlerInterceptorMap.put("b", new InterceptorB()); handlerInterceptorMap.put("c", new InterceptorC()); handlerInterceptorMap.put("d", new InterceptorD()); handlerInterceptorMap.put("e", new InterceptorE()); Map<String, CEKHandlerInterceptor> actual = config.sortByOrder(handlerInterceptorMap); assertThat(actual.entrySet()) .hasSameSizeAs(handlerInterceptorMap.entrySet()) .extracting(Map.Entry::getKey) .containsSequence("e", "d", "b", "a", "c"); }
@SuppressWarnings("unchecked") Map<String, CEKHandlerInterceptor> sortByOrder(Map<String, CEKHandlerInterceptor> handlerInterceptorMap) { return handlerInterceptorMap.entrySet().stream() .sorted(AnnotationAwareOrderComparator.INSTANCE.withSourceProvider( entry -> ((Map.Entry<String, CEKHandlerInterceptor>) entry) .getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new)); }
CEKWebAutoConfiguration { @SuppressWarnings("unchecked") Map<String, CEKHandlerInterceptor> sortByOrder(Map<String, CEKHandlerInterceptor> handlerInterceptorMap) { return handlerInterceptorMap.entrySet().stream() .sorted(AnnotationAwareOrderComparator.INSTANCE.withSourceProvider( entry -> ((Map.Entry<String, CEKHandlerInterceptor>) entry) .getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new)); } }
CEKWebAutoConfiguration { @SuppressWarnings("unchecked") Map<String, CEKHandlerInterceptor> sortByOrder(Map<String, CEKHandlerInterceptor> handlerInterceptorMap) { return handlerInterceptorMap.entrySet().stream() .sorted(AnnotationAwareOrderComparator.INSTANCE.withSourceProvider( entry -> ((Map.Entry<String, CEKHandlerInterceptor>) entry) .getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new)); }  }
CEKWebAutoConfiguration { @SuppressWarnings("unchecked") Map<String, CEKHandlerInterceptor> sortByOrder(Map<String, CEKHandlerInterceptor> handlerInterceptorMap) { return handlerInterceptorMap.entrySet().stream() .sorted(AnnotationAwareOrderComparator.INSTANCE.withSourceProvider( entry -> ((Map.Entry<String, CEKHandlerInterceptor>) entry) .getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new)); }   }
CEKWebAutoConfiguration { @SuppressWarnings("unchecked") Map<String, CEKHandlerInterceptor> sortByOrder(Map<String, CEKHandlerInterceptor> handlerInterceptorMap) { return handlerInterceptorMap.entrySet().stream() .sorted(AnnotationAwareOrderComparator.INSTANCE.withSourceProvider( entry -> ((Map.Entry<String, CEKHandlerInterceptor>) entry) .getValue())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (v1, v2) -> v1, LinkedHashMap::new)); }    }