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

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

Introduction

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

Prototype

public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements) 

Source Link

Document

Creates a mutable HashSet instance containing the given elements.

Usage

From source file:tech.beshu.ror.acl.definitions.ldaps.GroupsProviderLdapClient.java

default Set<String> getAvailableGroups() {
    return Sets.newHashSet(groups);
}

From source file:com.theoriginalbit.framework.peripheral.converter.ConverterSet.java

@Override
public Object fromLua(Object obj, Class<?> expected) throws LuaException {
    if (obj instanceof Map && expected == Set.class) {
        return Sets.newHashSet(((Map<?, ?>) obj).keySet());
    }/*  w w  w .  j a  v  a 2 s  . com*/
    return null;
}

From source file:com.spotify.reaper.storage.postgresql.RepairUnitMapper.java

public RepairUnit map(int index, ResultSet r, StatementContext ctx) throws SQLException {
    String[] columnFamilies = (String[]) r.getArray("column_families").getArray();
    RepairUnit.Builder builder = new RepairUnit.Builder(r.getString("cluster_name"),
            r.getString("keyspace_name"), Sets.newHashSet(columnFamilies));
    return builder.build(r.getLong("id"));
}

From source file:org.jgrades.security.service.PasswordPolicyServiceImpl.java

@Override
public Set<PasswordPolicy> getPasswordPolicies() {
    return Sets.newHashSet(pswdPolicyRepository.findAll());
}

From source file:com.oschrenk.flatfiles.util.PrefixRemoverLineTransformer.java

/**
 * Instantiates a new prefix remover line transformer.
 *
 * @param prefix/* w w w  .j  av  a2s  .com*/
 *            the prefix
 */
public PrefixRemoverLineTransformer(final String prefix) {
    this(Sets.newHashSet(prefix));
}

From source file:com.luna.sys.group.service.GroupService.java

public Set<Map<String, Object>> findIdAndNames(Searchable searchable, String groupName) {

    searchable.addSearchFilter("name", SearchOperator.like, groupName);

    return Sets.newHashSet(
            Lists.transform(findAll(searchable).getContent(), new Function<Group, Map<String, Object>>() {
                @Override/*from   w w w. ja va 2 s .com*/
                public Map<String, Object> apply(Group input) {
                    Map<String, Object> data = Maps.newHashMap();
                    data.put("label", input.getName());
                    data.put("value", input.getId());
                    return data;
                }
            }));
}

From source file:org.sensorhub.impl.persistence.h2.ProducerObsFilter.java

public ProducerObsFilter(String producerID, IDataFilter filter) {
    this.producerIDs = (producerID != null) ? Sets.newHashSet(producerID) : null;
    this.filter = filter;
}

From source file:org.terasology.Environment.java

/**
 * Default setup order/*from w  w  w. j a  v a  2s .  c  o m*/
 * @param modules 
 */
public Environment(Name... moduleNames) {

    try {
        reset(Sets.newHashSet(moduleNames));
    } catch (Exception e) {
        logger.error("Error", e);
        throw new RuntimeException(e);
    }
}

From source file:org.jclouds.compute.predicates.ImagePredicates.java

/**
 * evaluates true if the Image id is in the supplied set
 * //from w w  w.  j a v  a  2 s. co m
 * @param ids
 *           ids of the images
 * @return predicate
 */
public static Predicate<Image> idIn(Iterable<String> ids) {
    checkNotNull(ids, "ids must be defined");
    final Set<String> search = Sets.newHashSet(ids);
    return new Predicate<Image>() {
        @Override
        public boolean apply(Image image) {
            return search.contains(image.getId());
        }

        @Override
        public String toString() {
            return "idIn(" + search + ")";
        }
    };
}

From source file:voldemort.utils.UpdateClusterUtils.java

/**
 * Add a partition to the node provided/*w  w w . ja  v  a  2 s.  c  o m*/
 * 
 * @param node The node to which we'll add the partition
 * @param donatedPartition The partition to add
 * @return The new node with the new partition
 */
public static Node addPartitionToNode(final Node node, Integer donatedPartition) {
    return UpdateClusterUtils.addPartitionsToNode(node, Sets.newHashSet(donatedPartition));
}