Example usage for java.util LinkedHashSet LinkedHashSet

List of usage examples for java.util LinkedHashSet LinkedHashSet

Introduction

In this page you can find the example usage for java.util LinkedHashSet LinkedHashSet.

Prototype

public LinkedHashSet() 

Source Link

Document

Constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75).

Usage

From source file:de.perdian.apps.dashboard.mvc.modules.pingdom.PingdomController.java

private static Set<String> createIdentifierSet(String identifiers) {
    JsonNode identifiersNode = JsonUtil.fromJsonString(identifiers);
    Set<String> result = new LinkedHashSet<>();
    for (int i = 0; i < identifiersNode.size(); i++) {
        result.add(identifiersNode.get(i).asText());
    }/*www .j av  a  2s  . c  o m*/
    return result;
}

From source file:com.expedia.seiso.domain.service.search.SpaceDelimitedDatabaseWildCardTokenizer.java

public Set<String> tokenize(String termsString) {
    HashSet<String> tokens = new LinkedHashSet<String>();

    if (!StringUtils.isEmpty(termsString)) {
        String[] terms = termsString.split(TERM_DELIMITER);
        for (String term : terms) {
            if (!StringUtils.isEmpty(term)) {
                tokens.add(new StringBuilder(WILD_CARD).append(term.trim()).append(WILD_CARD).toString());
            }/*  ww w .  j a va2s.c o  m*/
        }
    }

    return tokens;
}

From source file:prospring3.ch5.beanpostprocessor.DeassociatePointcutAdvisor.java

public DeassociatePointcutAdvisor() {
    this.advice = buildAdvice();
    Set<Class<? extends Annotation>> annotations = new LinkedHashSet<Class<? extends Annotation>>();
    annotations.add(Deassociate.class);
    this.pointcut = buildPointcut(annotations);
}

From source file:com.bstek.dorado.core.io.ResourceUtils.java

/**
 * ??????//from   ww w. j a va  2s . co  m
 * 
 * @param resourceLocations
 *            ?
 * @return ????
 * @throws IOException
 */
public static Set<Resource> getResourceSet(String[] resourceLocations) throws IOException {
    Context context = Context.getCurrent();
    Set<Resource> resourceSet = new LinkedHashSet<Resource>();
    for (String resourceLocation : resourceLocations) {
        Resource[] resourceArray = context.getResources(resourceLocation);
        for (Resource resource : resourceArray) {
            if (!resourceSet.contains(resource)) {
                resourceSet.add(resource);
            }
        }
    }
    return resourceSet;
}

From source file:com.androidquery.auth.AccountHandle.java

public synchronized void auth(AbstractAjaxCallback<?, ?> cb) {

    if (callbacks == null) {
        callbacks = new LinkedHashSet<AbstractAjaxCallback<?, ?>>();
        callbacks.add(cb);/*w  w w  .j a  v a2  s .  co  m*/
        auth();
    } else {
        callbacks.add(cb);
    }

}

From source file:org.agiso.tempel.core.RecursiveTemplateVerifier.java

@Override
public void verifyTemplate(Template<?> template, ITemplateProvider templateProvider) {
    verifyTemplate(template, new LinkedHashSet<String>());
}

From source file:com.tussle.hitbox.HitboxComponent.java

public void put(ScriptIterator iterator, Hitbox hitbox) {
    if (!hitboxes.containsKey(iterator))
        hitboxes.put(iterator, new LinkedHashSet<>());
    hitboxes.get(iterator).add(hitbox);//from   w w w.  ja va  2s . c o m
}

From source file:fi.hsl.parkandride.ActiveProfileAppender.java

private Set<String> currentActiveProfiles() {
    String springProfilesActive = System.getProperty("spring.profiles.active");
    if (isNullOrEmpty(springProfilesActive)) {
        springProfilesActive = System.getenv("SPRING_PROFILES_ACTIVE");
    }/*from   ww  w  .j ava  2 s  . co m*/

    Set<String> profiles = new LinkedHashSet<>();
    if (!isNullOrEmpty(springProfilesActive)) {
        profiles.addAll(asList(springProfilesActive.split(",")));
    }
    return profiles;
}

From source file:com.tussle.hitbox.HurtboxComponent.java

public void put(ScriptIterator iterator, Hurtbox hurtbox) {
    if (!hurtboxes.containsKey(iterator))
        hurtboxes.put(iterator, new LinkedHashSet<>());
    hurtboxes.get(iterator).add(hurtbox);
}

From source file:com.github.jknack.amd4j.DependencyCollector.java

/**
 * Collect all the dependencies for the given module.
 *
 * @param config A configuration options.
 * @param module An AMD module./*from   w  w  w. j ava 2s.c  o  m*/
 * @return A dependency set.
 */
public static Set<String> collect(final Config config, final Module module) {
    // empty module?
    if (module.content.length() == 0) {
        return Collections.emptySet();
    }
    // just parse *.js files
    if (!"js".equals(getExtension(module.uri.getPath()))) {
        return Collections.emptySet();
    }

    return new NodeVisitor() {
        private Set<String> dependencies = new LinkedHashSet<String>();

        /**
         * Collect all the dependencies.
         *
         * @return A dependency set.
         */
        public Set<String> collect() {
            Parser parser = new Parser();
            AstRoot node = parser.parse(module.content.toString(), module.name, 1);
            node.visit(this);
            // check shim configuration
            Shim shim = config.getShim(module.name);
            if (shim != null) {
                // add dependencies
                if (shim.dependencies() != null) {
                    dependencies.addAll(shim.dependencies());
                }
            }
            return dependencies;
        }

        @Override
        public boolean visit(final AstNode node) {
            int type = node.getType();
            switch (type) {
            case Token.CALL:
                return visit((FunctionCall) node);
            default:
                return true;
            }
        }

        /**
         * Find out "define" and "require" function calls.
         *
         * @param node The function call node.
         * @return True, to keep walking.
         */
        public boolean visit(final FunctionCall node) {
            AstNode target = node.getTarget();
            if (target instanceof Name) {
                String name = ((Name) target).getIdentifier();
                if ("define".equals(name)) {
                    visitDependencies(node);
                } else if ("require".equals(name)) {
                    int depth = node.getParent().depth() - 1;
                    if (config.isFindNestedDependencies() || depth == 0) {
                        visitDependencies(node);
                    }
                }
            }
            return true;
        }

        /**
         * Report module's dependencies.
         *
         * @param node The function's call.
         */
        private void visitDependencies(final FunctionCall node) {
            List<AstNode> arguments = node.getArguments();
            for (AstNode arg : arguments) {
                if (arg instanceof ArrayLiteral) {
                    // found!
                    ArrayLiteral array = (ArrayLiteral) arg;
                    List<AstNode> dependencyList = array.getElements();
                    for (AstNode dependencyNode : dependencyList) {
                        String dependency = ((StringLiteral) dependencyNode).getValue();
                        String[] dependencies = StringUtils.split(dependency, "!");
                        if (dependencies.length > 1) {
                            this.dependencies.add(dependencies[0]);
                        }
                        this.dependencies.add(dependency);
                    }
                    break;
                }
            }
        }
    }.collect();
}