List of usage examples for java.util Set size
int size();
From source file:com.mirth.connect.util.MirthSSLUtil.java
public static String[] getEnabledHttpsCipherSuites(String[] requestedCipherSuites) { logger.debug("Requested SSL cipher suites: " + Arrays.toString(requestedCipherSuites)); SSLContext sslContext = SSLContexts.createDefault(); String[] supportedCipherSuites = sslContext.getSupportedSSLParameters().getCipherSuites(); Set<String> enabledCipherSuites = new LinkedHashSet<String>(); for (String cipherSuite : requestedCipherSuites) { if (ArrayUtils.contains(supportedCipherSuites, cipherSuite)) { enabledCipherSuites.add(cipherSuite); }/* ww w . ja v a 2s .c o m*/ } logger.debug("Enabled SSL cipher suites: " + String.valueOf(enabledCipherSuites)); return enabledCipherSuites.toArray(new String[enabledCipherSuites.size()]); }
From source file:fr.esiea.windmeal.fill.database.OwnerAndProviderImportationTest.java
private static Meal[] getMealsFromMap(Map<String, String> dataMap) { int acc = 1;//from w w w .j a v a 2 s . c o m Set<Meal> menu = new HashSet<Meal>(); while (dataMap.containsKey("mealname" + acc)) { Meal meal = createMeal(dataMap.get("mealname" + acc), dataMap.get("mealdescription" + acc), Double.valueOf(dataMap.get("mealprice" + acc))); menu.add(meal); acc++; } Meal[] mealArray = new Meal[menu.size()]; acc = 0; for (Meal meal : menu) { mealArray[acc] = meal; acc++; } return mealArray; }
From source file:info.novatec.testit.livingdoc.util.ClassUtils.java
public static ClassLoader toClassLoaderWithDefaultParent(Collection<String> classPaths) throws MalformedURLException { Set<URL> dependencies = new HashSet<URL>(); for (String classPath : classPaths) { File dependency = new File(classPath); dependencies.add(dependency.toURI().toURL()); }/*from w w w.j a v a2s . c o m*/ ClassLoader classLoader = URLClassLoader.newInstance(dependencies.toArray(new URL[dependencies.size()])); return classLoader; }
From source file:org.tec.webapp.jdbc.entity.support.PreparedStatementBuilder.java
/** * Build prepared statement for Select (and for where clause) * * @param tablename the table to select from * @param columns the set of column names * @param whereParams the map of where params * @return PreparedStatementBuilder to select *//*from w ww . j a va 2s . c o m*/ public static PreparedStatementBuilder getSelectBuilder(String tablename, Set<String> columns, ParameterMap whereParams) { // Nothing to update if (0 == columns.size()) { throw new RuntimeException("No parameters provided to update. " + tablename); } StringBuilder whereBuf = new StringBuilder(); if (whereParams != null && whereParams.size() > 0) { for (Iterator<String> itCol = whereParams.keySet().iterator(); itCol.hasNext();) { String key = itCol.next(); whereBuf.append(key); whereBuf.append("=?"); if (itCol.hasNext()) { whereBuf.append(" AND "); } } } return getSelectBuilder(tablename, columns, whereParams, whereBuf.toString()); }
From source file:info.novatec.testit.livingdoc.util.ClassUtils.java
public static ClassLoader toClassLoader(Collection<String> classPaths, ClassLoader parent) throws MalformedURLException { Set<URL> dependencies = new HashSet<URL>(); for (String classPath : classPaths) { File dependency = new File(classPath); dependencies.add(dependency.toURI().toURL()); }/* w ww .j a va 2 s . co m*/ ClassLoader classLoader = URLClassLoader.newInstance(dependencies.toArray(new URL[dependencies.size()]), parent); return classLoader; }
From source file:net.sourceforge.doddle_owl.utils.Utils.java
public static int getUserObjectNum(DefaultMutableTreeNode rootNode) { Set userObjectSet = new HashSet(); userObjectSet.add(rootNode.getUserObject()); getAllUserObject(rootNode, userObjectSet); return userObjectSet.size(); }
From source file:py.una.pol.karaku.test.util.TestUtils.java
/** * Retorna la lista de entidades relacionadas a una base. * /* w ww . j a v a2 s .c o m*/ * @param base * entidad base * @return array con todas las entidades que se pueden acceder desde base. */ public static Class<?>[] getReferencedClasses(Class<?> base) { LOG.info("Scanning for classes with relations with '{}'", base.getName()); Set<Class<?>> result = getReferencedClasses(base, new HashSet<Class<?>>(10)); result.add(base); for (Class<?> c : result) { LOG.info("Found class {} ", c.getSimpleName()); } LOG.info("Found '{}' classes with relations with '{}'", result.size(), base.getSimpleName()); return result.toArray(new Class<?>[result.size()]); }
From source file:tradeok.HttpTool.java
public static String set2json(Set<?> set) { StringBuilder json = new StringBuilder(); json.append("["); if (set != null && set.size() > 0) { for (Object obj : set) { json.append(object2json(obj)); json.append(","); }//from w w w.jav a2 s . c om json.setCharAt(json.length() - 1, ']'); } else { json.append("]"); } return json.toString(); }
From source file:info.mtgdb.api.Db.java
public static ArrayList<Card> getCards(Set<String> fields) { StringBuilder sb = new StringBuilder(); for (String s : fields) { sb.append(s + ","); }/*from w w w . j a v a 2 s. co m*/ if (fields.size() > 0) sb.deleteCharAt(sb.length() - 1); String url = API_URL + "/cards/?fields=" + sb.toString(); return getCardsFromUrl(url); }
From source file:com.htmlhifive.tools.jslint.util.ConfigBeanUtil.java
/** * ??????????.<br>//from w ww . j ava 2s .c om * TODO getAllOptionFromDefault???... * * @return */ public static CheckOption[] getAllJsHintOptionFromDefault() { JSHintDefaultOptions[] jsHintOptions = JSHintDefaultOptions.values(); JSLintDefaultOptions[] jsLintOptions = JSLintDefaultOptions.values(); Set<CheckOption> optionSet = new HashSet<CheckOption>(); for (JSHintDefaultOptions option : jsHintOptions) { optionSet.add(option.convertToOption()); } for (JSLintDefaultOptions option : jsLintOptions) { optionSet.add(option.convertToOption()); } return (CheckOption[]) optionSet.toArray(new CheckOption[optionSet.size()]); }