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(Iterable<? extends E> elements) 

Source Link

Document

Creates a mutable LinkedHashSet instance containing the given elements in order.

Usage

From source file:org.jclouds.tmrk.enterprisecloud.domain.template.TemplateOperatingSystems.java

private TemplateOperatingSystems(Set<TemplateOperatingSystem> operatingSystems) {
    this.operatingSystems = Sets.newLinkedHashSet(operatingSystems);
}

From source file:org.gradle.plugins.ide.eclipse.model.WtpComponent.java

public void configure(String deployName, String contextPath, List<WbModuleEntry> newEntries) {
    Iterable<WbModuleEntry> toKeep = Iterables.filter(wbModuleEntries,
            not(instanceOf(WbDependentModule.class)));
    this.wbModuleEntries = Lists.newArrayList(Sets.newLinkedHashSet(Iterables.concat(toKeep, newEntries)));
    if (!isNullOrEmpty(deployName)) {
        this.deployName = deployName;
    }//from   www. ja v  a 2s .c  om
    if (!isNullOrEmpty(contextPath)) {
        this.contextPath = contextPath;
    }
}

From source file:org.jclouds.tmrk.enterprisecloud.domain.template.TemplateReferences.java

private TemplateReferences(Set<NamedResource> templateReferences) {
    this.templateReferences = Sets.newLinkedHashSet(templateReferences);
}

From source file:org.jclouds.tmrk.enterprisecloud.domain.resource.cpu.VirtualMachinesCpuUsage.java

private VirtualMachinesCpuUsage(Set<VirtualMachineCpuUsageDetail> virtualMachinesCpuUsageDetail) {
    this.virtualMachinesCpuUsageDetail = Sets.newLinkedHashSet(virtualMachinesCpuUsageDetail);
}

From source file:org.summer.dsl.model.types.xtext.ui.IntersectingJavaSearchScope.java

public IPath[] enclosingProjectsAndJars() {
    if (scopes.length == 0)
        return new IPath[0];
    if (scopes.length == 1)
        return scopes[0].enclosingProjectsAndJars();
    Collection<IPath> result = null;
    for (IJavaSearchScope scope : scopes) {
        if (result == null) {
            result = Sets.newLinkedHashSet(Arrays.asList(scope.enclosingProjectsAndJars()));
        } else {/*from www .  j a v a2 s . c om*/
            result.retainAll(Arrays.asList(scope.enclosingProjectsAndJars()));
        }
    }
    if (result == null)
        return new IPath[0];
    return result.toArray(new IPath[result.size()]);
}

From source file:com.google.android.testing.nativedriver.server.handler.AndroidNativeFindChildElements.java

@Override
public ResultType call() throws Exception {
    response = newResponse();//w w w. ja  v a 2s  .  com

    List<WebElement> elements = getElement().findElements(by);
    Function<WebElement, Map<String, String>> transform = new Function<WebElement, Map<String, String>>() {
        public Map<String, String> apply(WebElement element) {
            return ImmutableMap.of("ELEMENT", getKnownElements().add(element));
        }
    };

    Set<Map<String, String>> elementIds = Sets.newLinkedHashSet(Iterables.transform(elements, transform));

    response.setValue(elementIds);
    return ResultType.SUCCESS;
}

From source file:com.enonic.cms.core.content.category.CategoryEntity.java

public CategoryEntity(CategoryEntity source) {
    this();/*from   w  w  w. jav  a 2 s  . c  o m*/

    this.key = source.getKey();
    this.name = source.getName();
    this.description = source.getDescription();
    this.created = source.getCreated();
    this.timestamp = source.getTimestamp();
    this.deleted = source.getDeleted();
    this.owner = source.getOwner();
    this.modifier = source.getModifier();
    this.unit = source.getUnit();
    this.contentType = source.getContentType();
    this.parent = source.getParent();
    this.children = source.getChildren() != null ? Lists.newArrayList(source.getChildren()) : null;
    this.accessRights = source.getAccessRights() != null ? Maps.newHashMap(source.getAccessRights()) : null;
    this.contents = source.getContents() != null ? Sets.newLinkedHashSet(source.getContents()) : null;
    this.autoMakeAvailable = source.getAutoMakeAvailable();
}

From source file:com.google.android.testing.nativedriver.server.handler.AndroidNativeFindElements.java

@Override
public ResultType call() throws Exception {
    response = newResponse();// ww  w. j  ava 2 s .com

    Function<WebElement, Map<String, String>> transform = new Function<WebElement, Map<String, String>>() {
        public Map<String, String> apply(WebElement element) {
            return ImmutableMap.of("ELEMENT", getKnownElements().add(element));
        }
    };

    List<WebElement> elements = getDriver().findElements(by);
    Set<Map<String, String>> elementIds = Sets.newLinkedHashSet(Iterables.transform(elements, transform));

    response.setValue(elementIds);
    return ResultType.SUCCESS;
}

From source file:brooklyn.util.collections.MutableSet.java

public MutableSet(Iterable<? extends V> source) {
    super((source instanceof Collection) ? (Collection<? extends V>) source : Sets.newLinkedHashSet(source));
}

From source file:org.eclipse.xtext.common.types.xtext.ui.IntersectingJavaSearchScope.java

@Override
public IPath[] enclosingProjectsAndJars() {
    if (scopes.length == 0)
        return new IPath[0];
    if (scopes.length == 1)
        return scopes[0].enclosingProjectsAndJars();
    Collection<IPath> result = null;
    for (IJavaSearchScope scope : scopes) {
        if (result == null) {
            result = Sets.newLinkedHashSet(Arrays.asList(scope.enclosingProjectsAndJars()));
        } else {// w  ww. ja v  a2  s  .c om
            result.retainAll(Arrays.asList(scope.enclosingProjectsAndJars()));
        }
    }
    if (result == null)
        return new IPath[0];
    return result.toArray(new IPath[result.size()]);
}