Java 类org.apache.commons.collections4.EnumerationUtils 实例源码

项目:GitDirStat    文件:GitRepositoryTreeNode.java   
@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);
    }
}
项目:GitDirStat    文件:GitRepositoryTreeNode.java   
@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);
    }
}
项目:jlubricant    文件:SpringSecurityFeature.java   
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);
    ;
}
项目:sdcct    文件:TomcatRequest.java   
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)));
}
项目:sdcct    文件:TomcatRequest.java   
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));
}
项目:codeforces-commons    文件:ArrayBuilder.java   
public <A extends E> ArrayBuilder<E> addAll(@Nonnull Enumeration<A> enumeration) {
    addAll(EnumerationUtils.toList(enumeration));
    return this;
}
项目:codeforces-commons    文件:ArrayBuilder.java   
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;
}