List of usage examples for java.util Set add
boolean add(E e);
From source file:Main.java
public static Set<String> split(String string, String separator) { Set<String> set = new HashSet<String>(); if (string == null) return set; String[] split = string.split(separator); for (String v : split) set.add(v.trim()); return set;// www . ja va2 s . c om }
From source file:org.syncope.core.util.EntitlementUtil.java
public static Set<Long> getRoleIds(final List<Entitlement> entitlements) { Set<String> names = new HashSet<String>(entitlements.size()); for (Entitlement entitlement : entitlements) { names.add(entitlement.getName()); }//from w ww. ja v a 2s .c o m return getRoleIds(names); }
From source file:Main.java
private static void appendTypeName(StringBuffer sb, Set typeNamesAppended, String name) { if (!typeNamesAppended.contains(name)) { if (sb.length() != 0) sb.append("+"); sb.append(name);//from www .ja va 2s. co m typeNamesAppended.add(name); } }
From source file:com.conwet.silbops.api.impl.XJSPSubEndpoint.java
private static <E> void addNotNull(Set<E> set, E elem) { set.add(Objects.requireNonNull(elem)); }
From source file:edu.cornell.mannlib.vitro.webapp.utils.logging.ToString.java
private static String setOfGraphsToString(Set<Graph> set) { Set<String> strings = new HashSet<>(); for (Graph g : set) { strings.add(graphToString(g)); }/*from ww w . java2s . com*/ return "[" + StringUtils.join(strings, ", ") + "]"; }
From source file:Main.java
public static Set<Integer> toSet(SparseBooleanArray array) { Set<Integer> trueSet = Sets.newHashSet(); for (int i = 0; i < array.size(); i++) { if (array.valueAt(i)) { int position = array.keyAt(i); trueSet.add(position); }/*from w w w .j a v a2 s . c o m*/ } return trueSet; }
From source file:Main.java
public static Set<?> asSet(Object o) { if (o instanceof Set) { return (Set<?>) o; } else if (o instanceof Collection) { Set<Object> set = createDefaultSet(); set.addAll((Collection<?>) o); return set; } else {/* w ww .j av a 2 s . c o m*/ Set<Object> set = createDefaultSet(); set.add(o); return set; } }
From source file:Main.java
/** * Converts an array of chars to a Set of Characters. * @param array the contents of the new Set * @return a Set containing the elements in the array *///from ww w. j a va2s . co m public static Set<Character> arrayToSet(char... array) { Set<Character> toReturn; if (array == null) return new HashSet<Character>(); toReturn = new HashSet<Character>(array.length); for (char c : array) { toReturn.add(c); } return toReturn; }
From source file:com.piusvelte.taplock.client.core.TapLock.java
protected static void storeDevices(Context context, SharedPreferences sp, ArrayList<JSONObject> devicesArr) { Set<String> devices = new HashSet<String>(); for (JSONObject deviceJObj : devicesArr) devices.add(deviceJObj.toString()); sp.edit().putStringSet(KEY_DEVICES, devices).commit(); (new BackupManager(context)).dataChanged(); }
From source file:com.gxl.test.shark.resource.redisSetData.java
public @BeforeClass static void init() { GenericObjectPoolConfig cfg = new GenericObjectPoolConfig(); cfg.setMaxIdle(10);/* w w w . j a v a 2s . c o m*/ cfg.setMinIdle(1); cfg.setMaxIdle(5); cfg.setMaxWaitMillis(5000); cfg.setTestOnBorrow(true); cfg.setTestOnReturn(true); Set<HostAndPort> hostAndPorts = new HashSet<HostAndPort>(); HostAndPort hostAndPort = new HostAndPort("120.24.75.22", 7000); hostAndPorts.add(hostAndPort); jedis = new JedisCluster(hostAndPorts, cfg); }