Example usage for com.google.common.collect Sets newLinkedHashSet

List of usage examples for com.google.common.collect Sets newLinkedHashSet

Introduction

In this page you can find the example usage for com.google.common.collect Sets newLinkedHashSet.

Prototype

public static <E> LinkedHashSet<E> newLinkedHashSet() 

Source Link

Document

Creates a mutable, empty LinkedHashSet instance.

Usage

From source file:net.sf.qualitycheck.immutableobject.domain.Annotations.java

@Nonnull
private static Set<Annotation> removeUnqualified(@Nonnull final List<Annotation> annotations,
        @Nonnull final Imports imports) {
    final Set<Annotation> result = Sets.newLinkedHashSet();
    for (final Annotation annotation : annotations) {
        if (annotation.getType().getPackage() == Package.UNDEFINED) {
            final Import imp = imports.find(annotation.getType().getName());
            if (imp != null) {
                result.add(new Annotation(imp.getType()));
            }//from  ww  w. ja v  a  2  s  .c o  m
        } else {
            result.add(annotation);
        }
    }
    return result;
}

From source file:com.enonic.cms.core.search.result.FacetsResultSet.java

public void addFacetResultSet(FacetResultSet facetResultSet) {
    if (facetResultSets == null) {
        this.facetResultSets = Sets.newLinkedHashSet();
    }//from w ww  .ja v a  2s  .  c o m

    this.facetResultSets.add(facetResultSet);
}

From source file:org.napile.compiler.lang.resolve.calls.inference.ConstraintsUtil.java

@NotNull
public static Set<NapileType> getValues(@Nullable TypeConstraints typeConstraints) {
    Set<NapileType> values = Sets.newLinkedHashSet();
    if (typeConstraints != null && !typeConstraints.isEmpty()) {
        if (!typeConstraints.getUpperBounds().isEmpty()) {
            //todo subTypeOfUpperBounds
            NapileType subTypeOfUpperBounds = typeConstraints.getUpperBounds().iterator().next(); //todo
            if (values.isEmpty()) {
                values.add(subTypeOfUpperBounds);
            }/*from  ww  w  .ja  v a 2  s . com*/
            for (NapileType value : values) {
                if (!NapileTypeChecker.INSTANCE.isSubtypeOf(value, subTypeOfUpperBounds)) {
                    values.add(subTypeOfUpperBounds);
                    break;
                }
            }
        }
    }
    return values;
}

From source file:components.cells.Positions.java

public static Set<IPosition> neighbours(final IPosition position, final Iterable<Direction> directions) {
    final Set<IPosition> positions = Sets.newLinkedHashSet();
    for (final Direction direction : directions)
        positions.add(position.apply(direction));
    return positions;
}

From source file:com.spotify.apollo.meta.model.ConfigFilter.java

static Set<String> configFilter(Config rootConfig) {
    checkNotNull(rootConfig);/*from w  w w  .  j a  va2s . co  m*/

    Set<String> filter = Sets.newLinkedHashSet();
    filter.add("passw");
    filter.add("secret");
    filter.add("private");

    if (rootConfig.hasPath("_meta.config-filter")) {
        final Config configFilter = rootConfig.getConfig("_meta.config-filter");
        for (Map.Entry<String, ConfigValue> filterEntry : configFilter.entrySet()) {
            if (filterEntry.getValue().unwrapped() == Boolean.TRUE) {
                filter.add(filterEntry.getKey());
            }
        }
    }

    return filter;
}

From source file:org.gradle.api.internal.tasks.compile.processing.ElementUtils.java

public static Set<String> getTopLevelTypeNames(Collection<? extends Element> originatingElements) {
    if (originatingElements == null || originatingElements.size() == 0) {
        return Collections.emptySet();
    }/*from   w ww.  ja v  a 2s.  c  o  m*/
    if (originatingElements.size() == 1) {
        String topLevelTypeName = getTopLevelTypeName(originatingElements.iterator().next());
        return Collections.singleton(topLevelTypeName);
    }
    Set<String> typeNames = Sets.newLinkedHashSet();
    for (Element element : originatingElements) {
        String topLevelTypeName = getTopLevelTypeName(element);
        typeNames.add(topLevelTypeName);
    }
    return typeNames;
}

From source file:org.eclipse.buildship.core.workspace.internal.ProjectNatureUpdater.java

private static Set<String> toNatures(Optional<List<OmniEclipseProjectNature>> projectNatures,
        IProjectDescription description) {
    Set<String> natures = Sets.newLinkedHashSet();
    if (projectNatures.isPresent()) {
        natures.addAll(toNatures(projectNatures.get()));
    } else {//  w  ww  .j  a v  a 2s. c  om
        natures.addAll(Arrays.asList(description.getNatureIds()));
    }
    natures.add(GradleProjectNature.ID);
    return natures;
}

From source file:com.eucalyptus.cassandra.common.Cassandra.java

public static Set<ServiceConfiguration> sortedServiceConfigurations() {
    final Set<ServiceConfiguration> sortedConfigurations = Sets.newLinkedHashSet();
    final List<ServiceConfiguration> services = ServiceConfigurations.list(Cassandra.class);
    for (final ServiceConfiguration configuration : services) {
        if (Hosts.isCoordinator(configuration.getInetAddress())) {
            sortedConfigurations.add(configuration);
        }/*from w  w w .j av  a 2  s  .c  o  m*/
    }
    sortedConfigurations.addAll(services.stream().sorted().collect(Collectors.toList()));
    return sortedConfigurations;
}

From source file:org.apache.isis.core.runtime.services.ServicesInstallerUtils.java

static <V extends Comparable<V>> LinkedHashSet<V> flatten(SortedMap<String, SortedSet<V>> positionedServices) {
    final LinkedHashSet<V> serviceList = Sets.newLinkedHashSet();
    final Set<String> keys = positionedServices.keySet();
    for (String position : keys) {
        final SortedSet<V> list = positionedServices.get(position);
        serviceList.addAll(list);//www  . j av  a2 s .c  o m
    }
    return serviceList;
}

From source file:org.ldp4j.server.utils.URIHelper.java

public static List<URI> getParents(final URI uri) {
    checkNotNull(uri, "URI cannot be null");
    Set<URI> parents = Sets.newLinkedHashSet();
    parents.add(uri);/*from   w  w w  .java  2 s. c om*/
    if (uri.isAbsolute() && !uri.isOpaque()) {
        URI base = current(uri);
        while (!isRoot(base)) {
            parents.add(base);
            base = parent(base);
        }
        parents.add(base);
    }
    return Lists.newArrayList(parents);
}