List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet(Iterator<? extends E> elements)
From source file:org.janusgraph.graphdb.tinkerpop.JanusGraphVariables.java
@Override public Set<String> keys() { return Sets.newHashSet(config.getKeys("")); }
From source file:eu.trentorise.opendata.semantics.exceptions.OpenEntityNotFoundException.java
public static Set<String> missingIds(Iterable<String> expectedIds, Iterable<String> foundIds) { Set expectedIdsSet = Sets.newHashSet(expectedIds); Set foundIdsSet = Sets.newHashSet(foundIds); if (expectedIdsSet.size() <= foundIdsSet.size()) { LOG.severe(" EXPECTED DIFFERENT IDs ARE " + expectedIdsSet.size() + ", WHICH IS LESS OR EQUAL THAN FOUND DIFFERENT IDs: " + foundIdsSet.size() + ", IGNORING THEM!"); return new HashSet(); }/*from w ww . j a v a 2 s. com*/ SetView<String> difference = Sets.difference(expectedIdsSet, foundIdsSet); return difference; }
From source file:com.persinity.common.db.metainfo.SkipTablesSchema.java
public SkipTablesSchema(final Collection<String> skipTables, final Schema schema) { notNull(skipTables);/* w ww .j a v a 2s. c o m*/ notNull(schema); this.skipTables = Sets.newHashSet(skipTables); this.schema = schema; }
From source file:com.kegare.friendlymobs.network.SelectMobMessage.java
@SideOnly(Side.CLIENT) @Override//from www. j a v a2s.co m public IMessage onMessage(SelectMobMessage message, MessageContext ctx) { Minecraft mc = FMLClientHandler.instance().getClient(); mc.displayGuiScreen(new GuiSelectMob(mc.currentScreen) .setPresetMobs(Sets.newHashSet(FriendlyMobsAPI.getFriendlyMobs()))); return null; }
From source file:com.google.jstestdriver.model.BasePaths.java
public BasePaths(File... paths) { this(Sets.newHashSet(paths)); }
From source file:org.n52.iceland.ogc.filter.IdFilter.java
public IdFilter(String id) { this(Sets.newHashSet(id)); }
From source file:com.palantir.atlasdb.factory.Leaders.java
/** * Creates a LeaderElectionService using the supplied configuration and * registers appropriate endpoints for that service. *//*from w w w .ja v a 2 s .c o m*/ public static LeaderElectionService create(Optional<SSLSocketFactory> sslSocketFactory, Environment env, LeaderConfig config) { PaxosAcceptor ourAcceptor = PaxosAcceptorImpl.newAcceptor(config.acceptorLogDir().getPath()); PaxosLearner ourLearner = PaxosLearnerImpl.newLearner(config.learnerLogDir().getPath()); Set<String> remoteLeaderUris = Sets.newHashSet(config.leaders()); remoteLeaderUris.remove(config.localServer()); List<PaxosLearner> learners = AtlasDbHttpClients.createProxies(sslSocketFactory, remoteLeaderUris, PaxosLearner.class); learners.add(ourLearner); List<PaxosAcceptor> acceptors = AtlasDbHttpClients.createProxies(sslSocketFactory, remoteLeaderUris, PaxosAcceptor.class); acceptors.add(ourAcceptor); Map<PingableLeader, HostAndPort> otherLeaders = generatePingables(remoteLeaderUris, sslSocketFactory); ExecutorService executor = Executors.newCachedThreadPool(); PaxosProposer proposer = PaxosProposerImpl.newProposer(ourLearner, ImmutableList.copyOf(acceptors), ImmutableList.copyOf(learners), config.quorumSize(), executor); PaxosLeaderElectionService leader = new PaxosLeaderElectionService(proposer, ourLearner, otherLeaders, ImmutableList.copyOf(acceptors), ImmutableList.copyOf(learners), executor, config.pingRateMs(), config.randomWaitBeforeProposingLeadershipMs(), config.leaderPingResponseWaitMs()); env.register(ourAcceptor); env.register(ourLearner); env.register(leader); env.register(new NotCurrentLeaderExceptionMapper()); return leader; }
From source file:voldemort.utils.NodeUtils.java
/** * Add a partition to the node provided/*from w w w .j a v a 2s . 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 addPartitionToNode(node, Sets.newHashSet(donatedPartition)); }
From source file:org.ingini.mongodb.jongo.example.domain.characters.Hero.java
public static Hero addBeast(Hero hero, Beast beast) { return new Hero(hero.getId(), hero.getFirstName(), hero.getLastName(), hero.getAddress(), hero.getChildren(), Sets.newHashSet(beast), hero.getWeapon()); }
From source file:com.google.javascript.jscomp.newtypes.NaivePersistentSet.java
public PersistentSet<K> without(K key) { Set<K> newSet = Sets.newHashSet(this.set); newSet.remove(key);// w w w .ja v a2 s . co m return new NaivePersistentSet<>(newSet); }