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:cc.kave.episodes.mining.evaluation.EpisodeRecommender.java

public Set<Tuple<Episode, Double>> getProposals(Episode query, Map<Integer, Set<Episode>> patterns,
        int numberOfProposals) {
    assertTrue(query.getNumEvents() > 0, "Input a valid query!");
    assertTrue(!patterns.isEmpty(), "The list of learned episodes is empty!");
    assertTrue(numberOfProposals > 0, "Request a positive number of proposals to show!");

    Set<Tuple<Episode, Double>> allProposals = sortProposals(query, patterns);
    Set<Tuple<Episode, Double>> limitedProposals = Sets.newLinkedHashSet();

    int counter = 0;
    for (Tuple<Episode, Double> tuple : allProposals) {
        if ((counter < numberOfProposals) && !episodeIsPartOfQuery(query, tuple.getFirst())) {
            if ((tuple.getSecond() > 0.0) || (tuple.getSecond() == 0.0) && (query.getNumEvents() == 1)) {
                limitedProposals.add(tuple);
                counter++;//  www.j  a  v a  2  s  .c om
            }
        }
    }
    return limitedProposals;
}

From source file:com.github.autermann.yaml.nodes.YamlSetNode.java

/**
 * Create a new {@link YamlSetNode}.//  ww  w  .j  av a 2  s.c  o  m
 *
 * @param factory the factory to create children
 */
public YamlSetNode(YamlNodeFactory factory) {
    super(factory);
    this.nodes = Sets.newLinkedHashSet();
}

From source file:org.gradle.vcs.internal.DefaultVcsMappings.java

public DefaultVcsMappings(Instantiator instantiator) {
    this.versionControlSpecFactory = new VersionControlSpecFactory(instantiator);
    this.vcsMappings = Sets.newLinkedHashSet();
}

From source file:edu.cmu.lti.oaqa.framework.eval.retrieval.EvaluationHelper.java

public static <T> List<String> getUniqeDocIdList(List<T> results, Ordering<T> ordering,
        Function<T, String> toIdString) {
    Collections.sort(results, ordering);
    Set<String> list = Sets.newLinkedHashSet();
    for (T result : results) {
        list.add(toIdString.apply(result));
    }/*w ww  . j a v  a2s  .c  o m*/
    return Lists.newArrayList(list);
}

From source file:com.mgmtp.jfunk.data.generator.data.IndexedFields.java

public void addFieldSet(final FieldSet fieldSet) {
    Set<FieldSet> fieldSets = fieldSetsMap.get(fieldSet.getDataKey());
    if (fieldSets == null) {
        fieldSets = Sets.newLinkedHashSet();
        fieldSetsMap.put(fieldSet.getDataKey(), fieldSets);
    }/*from  w  w w  .  jav a  2s .  c  o m*/
    fieldSets.add(fieldSet);
}

From source file:de.matzefratze123.heavyspleef.core.player.PlayerManager.java

public PlayerManager(JavaPlugin plugin) {
    onlineSpleefPlayers = Sets.newLinkedHashSet();

    Bukkit.getPluginManager().registerEvents(this, plugin);
}

From source file:org.terasology.polyworld.graph.Region.java

/**
 * @param centerPos the center of the region
 *//*from  w  w w  .  j  av  a2 s. c  o  m*/
public Region(ImmutableVector2f centerPos) {
    this.center = centerPos;
    this.corners = Sets.newTreeSet(new AngleOrdering(centerPos));
    this.borders = Sets.newLinkedHashSet();
    this.neighbors = Sets.newLinkedHashSet();
}

From source file:org.gradle.process.internal.util.MergeOptionsUtil.java

public static Set<String> normalized(Iterable<String> strings) {
    Set<String> normalized = Sets.newLinkedHashSet();
    for (String string : strings) {
        normalized.add(normalized(string));
    }//  w  w w.  j a v a  2 s . c o  m
    return normalized;
}

From source file:org.apache.lens.server.api.util.LensUtil.java

public static <T> Set<T> getImplementationsMutable(final String factoriesKey, final Configuration conf) {
    Set<T> implSet = Sets.newLinkedHashSet();
    final String[] factoryNames = conf.getStrings(factoriesKey);
    if (factoryNames != null) {
        for (String factoryName : factoryNames) {
            if (StringUtils.isNotBlank(factoryName)) {
                final T implementation = getImplementation(factoryName.trim(), conf);
                implSet.add(implementation);
            }//  w ww .  j  a  v a  2 s .com
        }
    }
    return implSet;
}

From source file:cc.recommenders.evaluation.distribution.calc.QueryTypeWorker.java

public Set<NM> getInterestingValues() {
    Set<NM> nms = Sets.newLinkedHashSet();
    nms.add(new NM(0, 1));
    nms.add(new NM(0, 2));
    nms.add(new NM(0, 3));
    nms.add(new NM(0, 4));
    nms.add(new NM(0, 5));
    nms.add(new NM(0, 6));
    nms.add(new NM(1, 2));
    nms.add(new NM(1, 3));
    nms.add(new NM(2, 4));
    nms.add(new NM(2, 5));
    nms.add(new NM(3, 6));
    return nms;//  www. j ava  2  s  .  c  om
}