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:guru.qas.martini.jmeter.TagResourceBundle.java

@Nonnull
@Override//  w  w w  . j av a 2 s  .co  m
public Set<String> keySet() {
    LinkedHashSet<String> set = Sets.newLinkedHashSet(tags);
    Iterators.addAll(set, delegate.getKeys().asIterator());
    return set;
}

From source file:net.sourceforge.ganttproject.io.CSVOptions.java

public CSVOptions() {
    List<TaskDefaultColumn> orderedColumns = ImmutableList.of(TaskDefaultColumn.ID, TaskDefaultColumn.NAME,
            TaskDefaultColumn.BEGIN_DATE, TaskDefaultColumn.END_DATE, TaskDefaultColumn.DURATION,
            TaskDefaultColumn.COMPLETION, TaskDefaultColumn.COST);
    LinkedHashSet<TaskDefaultColumn> columns = Sets.newLinkedHashSet(Arrays.asList(TaskDefaultColumn.values()));
    columns.removeAll(orderedColumns);//from   ww w. j ava2 s. c o  m
    for (TaskDefaultColumn taskColumn : orderedColumns) {
        createTaskExportOption(taskColumn);
    }
    for (TaskDefaultColumn taskColumn : columns) {
        if (!ourIgnoredTaskColumns.contains(taskColumn)) {
            createTaskExportOption(taskColumn);
        }
    }
    createTaskExportOption("webLink");
    createTaskExportOption("notes");

    myResourceOptions.put("id", new DefaultBooleanOption("id", true));
    for (ResourceDefaultColumn resourceColumn : ResourceDefaultColumn.values()) {
        createResourceExportOption(resourceColumn);
    }
}

From source file:co.cask.tephra.TransactionContext.java

public TransactionContext(TransactionSystemClient txClient, Iterable<TransactionAware> txAwares) {
    // Use a set to avoid adding the same TransactionAware twice and to make removal faster.
    // Use a linked hash set so that insertion order is preserved (same behavior as when it was using a List).
    this.txAwares = Sets.newLinkedHashSet(txAwares);
    this.txClient = txClient;
}

From source file:au.id.wolfe.fxassetman.server.dao.jpa.AssetDaoImpl.java

@SuppressWarnings("unchecked")
@Override//from  www. ja  v  a  2 s.com
public Set<Asset> findAll() {
    return Sets.newLinkedHashSet(entityManager.createQuery("SELECT a FROM Asset a").getResultList());
}

From source file:de.marx_labs.utilities.common.searchtree.MapDBSearchTree.java

@Override
public Set<T> newest(int size) {
    Long key = treeMap.lastKey();
    Set<T> matches = new LinkedHashSet<T>();
    for (int i = 0; i < size; i++) {
        matches.add(treeMap.get(key));/*from   w w  w  . j  av  a2  s.c  o  m*/
        key = treeMap.lowerKey(key);

        if (key == null) {
            break;
        }
    }

    List<T> reverseList = Lists.reverse(Lists.newArrayList(matches));

    return Sets.newLinkedHashSet(reverseList);
}

From source file:org.jclouds.tmrk.enterprisecloud.domain.layout.Rows.java

private Rows(Set<LayoutRow> entries) {
    this.rows = Sets.newLinkedHashSet(entries);
}

From source file:org.eclipse.sirius.business.api.session.AbstractSavingPolicy.java

@Override
public Collection<Resource> save(final Iterable<Resource> allResources, final Map<?, ?> options,
        IProgressMonitor monitor) {//www. j  ava2s  . c o  m
    final Collection<Resource> resourcesToSave = Lists.newArrayList();
    try {
        monitor.beginTask(Messages.AbstractSavingPolicy_saveMsg, IProgressMonitor.UNKNOWN);
        resourcesToSave.addAll(computeResourcesToSave(Sets.newLinkedHashSet(allResources), options, monitor));
        if (options == null) {
            ResourceSetSync.getOrInstallResourceSetSync(domain).save(resourcesToSave, allResources,
                    getDefaultSaveOptions());
        } else {
            ResourceSetSync.getOrInstallResourceSetSync(domain).save(resourcesToSave, allResources, options);
        }
    } catch (final IOException e) {
        SiriusPlugin.getDefault().error(Messages.AbstractSavingPolicy_savingErrorMsg, e);
    } catch (final InterruptedException e) {
        SiriusPlugin.getDefault().error(Messages.AbstractSavingPolicy_savingErrorMsg, e);
    } finally {
        monitor.done();
    }
    return resourcesToSave;
}

From source file:org.jclouds.rackspace.cloudservers.compute.suppliers.CloudServersHardwareSupplier.java

@Override
public Set<? extends Hardware> get() {
    final Set<Hardware> hardware;
    logger.debug(">> providing hardware");
    hardware = Sets.newLinkedHashSet(Iterables.transform(sync.listFlavors(withDetails()), flavorToHardware));
    logger.debug("<< hardware(%d)", hardware.size());
    return hardware;
}

From source file:org.jclouds.tmrk.enterprisecloud.domain.layout.Groups.java

private Groups(Set<LayoutGroup> entries) {
    this.groups = Sets.newLinkedHashSet(entries);
}

From source file:org.obiba.magma.spring.SpringContextScanningDatasource.java

public void addValueTable(ValueTableFactoryBean tableFactory) {
    // Make a copy: we don't know if the injected set is mutable.
    Set<ValueTableFactoryBean> newTables = Sets.newLinkedHashSet(valueTableFactoryBeans);
    newTables.add(tableFactory);/*  ww  w  . j  a va2s . c o m*/
    valueTableFactoryBeans = newTables;
    reloadValueTable(tableFactory.getValueTableName());
}