List of usage examples for com.google.common.collect ImmutableSet.Builder add
boolean add(E e);
From source file:org.wso2.carbon.registry.social.api.utils.EnumUtil.java
/** * @param vals array of enums/* www . java 2 s . c o m*/ * @return a set of the names for a list of Enum values defined by toString */ public static Set<String> getEnumStrings(java.lang.Enum<?>... vals) { ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (java.lang.Enum<?> v : vals) { builder.add(v.toString()); } Set<String> result = builder.build(); if (result.size() != vals.length) { throw new IllegalArgumentException("Enum names are not disjoint set"); } return result; }
From source file:com.spectralogic.ds3autogen.utils.ArgumentsUtil.java
/** * Retrieves the set of all types within a list of Arguments */// w w w . ja v a2s .c o m public static ImmutableSet<String> getAllArgumentTypes(final ImmutableList<Arguments> args) { if (isEmpty(args)) { return ImmutableSet.of(); } final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); for (final Arguments arg : args) { builder.add(arg.getType()); } return builder.build(); }
From source file:org.jclouds.softlayer.SoftLayerProviderMetadata.java
public static Properties defaultProperties() { Properties properties = new Properties(); properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_LOGIN_DETAILS_DELAY, "" + 60 * 60 * 1000); properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_PACKAGE_NAME, "Cloud Server"); // ex: for private (ex. don't share hardware) use "Private [0-9]+ x ([.0-9]+) GHz Core[s]?" // ex: for private and public use ".*[0-9]+ x ([.0-9]+) GHz Core[s]?" properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_CPU_REGEX, "[0-9]+ x ([0-9.]+) GHz Core[s]?"); // SAN or LOCAL properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_DISK0_TYPE, "LOCAL"); // 10, 100, 1000 properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_PORT_SPEED, "10"); ImmutableSet.Builder<String> prices = ImmutableSet.builder(); prices.add("21"); // 1 IP Address prices.add("55"); // Host Ping: categoryCode: monitoring, notification prices.add("57"); // Email and Ticket: categoryCode: notification prices.add("58"); // Automated Notification: categoryCode: response prices.add("1800"); // 0 GB Bandwidth: categoryCode: bandwidth prices.add("905"); // Reboot / Remote Console: categoryCode: remote_management prices.add("418"); // Nessus Vulnerability Assessment & Reporting: categoryCode: // vulnerability_scanner prices.add("420"); // Unlimited SSL VPN Users & 1 PPTP VPN User per account: categoryCode: // vpn_management properties.setProperty(PROPERTY_SOFTLAYER_VIRTUALGUEST_PRICES, Joiner.on(',').join(prices.build())); properties.setProperty(TEMPLATE,/*from w w w . ja v a2 s.c om*/ "osFamily=UBUNTU,osVersionMatches=1[012].[01][04],os64Bit=true,osDescriptionMatches=.*Minimal Install.*"); return properties; }
From source file:com.google.doubleclick.openrtb.CompanionTypeMapper.java
public static ImmutableSet<CompanionType> toOpenRtb(Collection<CreativeFormat> dcList) { ImmutableSet.Builder<CompanionType> openrtbSet = ImmutableSet.builder(); for (CreativeFormat dc : dcList) { openrtbSet.add(toOpenRtb(dc)); }/* w ww.j a va 2 s. com*/ return openrtbSet.build(); }
From source file:org.gradle.api.internal.artifacts.configurations.Configurations.java
public static ImmutableSet<String> getNames(Collection<Configuration> configurations) { if (configurations.isEmpty()) { return ImmutableSet.of(); } else if (configurations.size() == 1) { return ImmutableSet.of(configurations.iterator().next().getName()); }// w w w .j a v a2 s . c om ImmutableSet.Builder<String> names = new ImmutableSet.Builder<String>(); for (Configuration configuration : configurations) { names.add(configuration.getName()); } return names.build(); }
From source file:com.isotrol.impe3.pms.core.obj.Builders.java
static <T> ImmutableSet.Builder<T> add(ImmutableSet.Builder<T> builder, T element) { if (builder == null) { builder = ImmutableSet.builder(); }//from ww w . j av a 2s . c om return builder.add(element); }
From source file:com.spectralogic.ds3contractcomparator.print.utils.PrinterUtils.java
/** * Gets the union of names of all params within two {@link ImmutableList} of {@link Ds3Param} *//*from www. ja v a2 s . c o m*/ public static ImmutableSet<String> getParamNameUnion(final ImmutableList<Ds3Param> oldParams, final ImmutableList<Ds3Param> newParams) { final ImmutableSet.Builder<String> builder = ImmutableSet.builder(); if (hasContent(oldParams)) { oldParams.forEach(param -> builder.add(param.getName())); } if (hasContent(newParams)) { newParams.forEach(param -> builder.add(param.getName())); } return builder.build(); }
From source file:com.facebook.buck.ocaml.OcamlUtil.java
static ImmutableSet<Path> getExtensionVariants(Path output, String... extensions) { String withoutExtension = stripExtension(output.toString()); ImmutableSet.Builder<Path> builder = ImmutableSet.builder(); for (String ext : extensions) { builder.add(Paths.get(withoutExtension + ext)); }/*from w w w . j a va 2 s . co m*/ return builder.build(); }
From source file:edu.mit.streamjit.util.affinity.Affinity.java
private static ImmutableSet<Integer> expand(long mask) { ImmutableSet.Builder<Integer> builder = ImmutableSet.builder(); for (int i = 0; i < Long.SIZE && mask != 0; ++i) { if ((mask & 1) != 0) builder.add(i); mask >>>= 1;// w w w. j a v a 2 s. com } return builder.build(); }
From source file:com.maddyhome.idea.vim.action.VimCommandAction.java
@NotNull protected static Set<List<KeyStroke>> parseKeysSet(@NotNull String... keyStrings) { final ImmutableSet.Builder<List<KeyStroke>> builder = ImmutableSet.builder(); for (String keyString : keyStrings) { builder.add(StringHelper.parseKeys(keyString)); }//w w w. j a v a2s. co m return builder.build(); }