@SuppressWarnings("unchecked") private void deepSort(DefaultMutableTreeNode parent, TreeObjectSortBy sortBy, SortOrder order) { Enumeration<DefaultMutableTreeNode> treeObjectNodes = parent.children(); List<DefaultMutableTreeNode> treeNodes = EnumerationUtils .toList(treeObjectNodes); BeanToPropertyValueTransformer sortProperty = getSortByTransformer(sortBy); Comparator<DefaultMutableTreeNode> comparator = new TransformingComparator( sortProperty); if (SortOrder.DESC.equals(order)) { comparator = new ReverseComparator<DefaultMutableTreeNode>( comparator); } Collections.sort(treeNodes, comparator); parent.removeAllChildren(); for (DefaultMutableTreeNode childNode : treeNodes) { parent.add(childNode); deepSort(childNode, sortBy, order); } }
public void contextInitialized(ServletContextEvent sce) { ServletContext servletContext = sce.getServletContext(); Object attribute = servletContext.getAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE ); if(attribute == null){ Enumeration<String> attributeNames = servletContext.getAttributeNames(); throw new IllegalStateException( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE + " not ready. Available attributes: " + EnumerationUtils.toList(attributeNames) ); } EnumSet<DispatcherType> dispatcherTypes = EnumSet.of(DispatcherType.REQUEST); boolean isMatchAfter = true; String urlPatterns = "/*"; servletContext .addFilter("springSecurityFilterChain", DelegatingFilterProxy.class.getCanonicalName()) .addMappingForUrlPatterns(dispatcherTypes, isMatchAfter, urlPatterns); ; }
public Map<String, List<String>> getHeaders() { return EnumerationUtils.toList(this.getHeaderNames()).stream().collect(SdcctStreamUtils.toMap(Function.identity(), headerName -> EnumerationUtils.toList(this.getHeaders(headerName)), () -> new TreeMap<>(String.CASE_INSENSITIVE_ORDER))); }
public Map<String, List<String>> getParameters() { return EnumerationUtils.toList(this.getParameterNames()).stream().sorted(String.CASE_INSENSITIVE_ORDER).collect(SdcctStreamUtils .toMap(Function.identity(), paramName -> Stream.of(this.getParameterValues(paramName)).collect(Collectors.toList()), LinkedHashMap::new)); }
public <A extends E> ArrayBuilder<E> addAll(@Nonnull Enumeration<A> enumeration) { addAll(EnumerationUtils.toList(enumeration)); return this; }
public <A extends E> ArrayBuilder<E> addAll(@Nonnull Enumeration<A> enumeration, @Nonnull ElementFilter<A> filter) { addAll(EnumerationUtils.toList(enumeration).stream().filter(filter::matches).collect(Collectors.toList())); return this; }