Set<String> oldHostsNoLongerPresent = Sets.newTreeSet();
private SortedSet<Address> getDefaultServers() throws IOException { SortedSet<Address> defaultServers = Sets.newTreeSet(); for (ServerName serverName : getOnlineRS()) { Address server = Address.fromParts(serverName.getHostname(), serverName.getPort()); boolean found = false; for (RSGroupInfo rsgi : listRSGroups()) { if (!RSGroupInfo.DEFAULT_GROUP.equals(rsgi.getName()) && rsgi.containsServer(server)) { found = true; break; } } if (!found) { defaultServers.add(server); } } return defaultServers; }
/** * List all of the files in 'dir' that match the regex 'pattern'. * Then check that this list is identical to 'expectedMatches'. * @throws IOException if the dir is inaccessible */ public static void assertGlobEquals(File dir, String pattern, String ... expectedMatches) throws IOException { Set<String> found = Sets.newTreeSet(); for (File f : FileUtil.listFiles(dir)) { if (f.getName().matches(pattern)) { found.add(f.getName()); } } Set<String> expectedSet = Sets.newTreeSet( Arrays.asList(expectedMatches)); Assert.assertEquals("Bad files matching " + pattern + " in " + dir, Joiner.on(",").join(expectedSet), Joiner.on(",").join(found)); }
if (tPerm.getFamily() != null) { if (tPerm.getQualifier() != null) { Set<byte[]> qualifiers = Sets.newTreeSet(Bytes.BYTES_COMPARATOR); qualifiers.add(tPerm.getQualifier()); familyMap.put(tPerm.getFamily(), qualifiers);
if (tperm.getFamily() != null) { if (tperm.getQualifier() != null) { Set<byte[]> qualifiers = Sets.newTreeSet(Bytes.BYTES_COMPARATOR); qualifiers.add(tperm.getQualifier()); familyMap.put(tperm.getFamily(), qualifiers);
/** * Creates a <i>mutable</i> {@code TreeSet} instance containing the given elements sorted by their * natural ordering. * * <p><b>Note:</b> if mutability is not required, use {@link ImmutableSortedSet#copyOf(Iterable)} * instead. * * <p><b>Note:</b> If {@code elements} is a {@code SortedSet} with an explicit comparator, this * method has different behavior than {@link TreeSet#TreeSet(SortedSet)}, which returns a {@code * TreeSet} with that comparator. * * <p><b>Note for Java 7 and later:</b> this method is now unnecessary and should be treated as * deprecated. Instead, use the {@code TreeSet} constructor directly, taking advantage of the new * <a href="http://goo.gl/iz2Wi">"diamond" syntax</a>. * * <p>This method is just a small convenience for creating an empty set and then calling {@link * Iterables#addAll}. This method is not very useful and will likely be deprecated in the future. * * @param elements the elements that the set should contain * @return a new {@code TreeSet} containing those elements (minus duplicates) */ public static <E extends Comparable> TreeSet<E> newTreeSet(Iterable<? extends E> elements) { TreeSet<E> set = newTreeSet(); Iterables.addAll(set, elements); return set; }
private SortedSet<Address> getDefaultServers() throws IOException { SortedSet<Address> defaultServers = Sets.newTreeSet(); for (ServerName serverName : getOnlineRS()) { Address server = Address.fromParts(serverName.getHostname(), serverName.getPort()); boolean found = false; for(RSGroupInfo rsgi: listRSGroups()) { if(!RSGroupInfo.DEFAULT_GROUP.equals(rsgi.getName()) && rsgi.containsServer(server)) { found = true; break; } } if (!found) { defaultServers.add(server); } } return defaultServers; }
private SortedSet<Address> getDefaultServers() throws IOException { SortedSet<Address> defaultServers = Sets.newTreeSet(); for (ServerName serverName : getOnlineRS()) { Address server = Address.fromParts(serverName.getHostname(), serverName.getPort()); boolean found = false; for(RSGroupInfo rsgi: listRSGroups()) { if(!RSGroupInfo.DEFAULT_GROUP.equals(rsgi.getName()) && rsgi.containsServer(server)) { found = true; break; } } if (!found) { defaultServers.add(server); } } return defaultServers; }
/** * List all of the files in 'dir' that match the regex 'pattern'. * Then check that this list is identical to 'expectedMatches'. * @throws IOException if the dir is inaccessible */ public static void assertGlobEquals(File dir, String pattern, String ... expectedMatches) throws IOException { Set<String> found = Sets.newTreeSet(); for (File f : FileUtil.listFiles(dir)) { if (f.getName().matches(pattern)) { found.add(f.getName()); } } Set<String> expectedSet = Sets.newTreeSet( Arrays.asList(expectedMatches)); Assert.assertEquals("Bad files matching " + pattern + " in " + dir, Joiner.on(",").join(expectedSet), Joiner.on(",").join(found)); }