Best code examples for Java 8 Set class (java.util.Set)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Set class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Java 8 Set examples from Open Source projects
This code example shows how to use the following methods: add
	bhash.put(bbar, bcar);
	bhash.put(bcar, bbar);
	jedis.hmset(bfoo, bhash);
 
	Set<byte[]> bkeys = jedis.hkeys(bfoo);
	Set<byte[]> bexpected = new LinkedHashSet<byte[]>();
	bexpected.add(bbar);
	bexpected.add(bcar);
	assertEquals(bexpected, bkeys);
    } 
 
    @Test 
    public void hvals() { 
	Map<String, String> hash = new LinkedHashMap<String, String>();
	hash.put("bar", "car");
	hash.put("car", "bar");
	jedis.hmset("foo", hash);
 
	List<String> vals = jedis.hvals("foo");
	assertEquals(2, vals.size());
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: add
    static final String UNEXPECTED_FAILURES_TABLE = "unexpectedFailures";
    static final String EXPECTED_PASSES_TABLE = "expextedPasses";
    static final String UNEXPECTED_PASSES_TABLE = "unexpextedPasses";
    private static final Set<String> TABLES_NAMES = new HashSet<String>();
    { 
        TABLES_NAMES.add(EXPECTED_FAILURES_TABLE);
        TABLES_NAMES.add(EXPECTED_PASSES_TABLE);
        TABLES_NAMES.add(UNEXPECTED_FAILURES_TABLE);
        TABLES_NAMES.add(UNEXPECTED_PASSES_TABLE);
    } 
 
    private static final void createTables(SQLiteDatabase db) {
        String cmd;
        for (String tableName : TABLES_NAMES) {
            cmd = "create table " + tableName + " ("
                    + KEY_ID + " integer primary key autoincrement, "
                    + KEY_PATH + " text not null, "
                    + KEY_BYTES + " blob not null);";
            db.execSQL(cmd);
        } 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: isEmpty, removeAll
            String name2, SortedSet<String> set2) {
        Set<String> onlyInSet1 = new TreeSet<String>(set1);
 
        onlyInSet1.removeAll(set2);
 
        Set<String> onlyInSet2 = new TreeSet<String>(set2);
        onlyInSet2.removeAll(set1);
 
        if (!onlyInSet1.isEmpty() || !onlyInSet2.isEmpty()) {
            fail(String.format("in %s only: %s\nin %s only: %s", name1, onlyInSet1, name2, onlyInSet2));
        } 
 
        assertEquals(set2, set1);
    } 
 
    protected SortedSet<String> findAllPropertyNames(Class<?> clazz) throws Exception {
        SortedSet<String> names = new TreeSet<String>();
        for (PropertyDescriptor propDesc : getBeanInfo(clazz).getPropertyDescriptors()) {
            if (propDesc == null
                    || propDesc.getWriteMethod() == null) {
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: add
 
    Object snapshotValue = snapshot.get(key);
    if (snapshotValue == null) {
      final OIdentifiable storedValue = indexEngine.get(key);
 
      final Set<OIdentifiable> values = new LinkedHashSet<OIdentifiable>();
 
      if (storedValue != null)
        values.add(storedValue.getIdentity());
 
      values.add(value.getIdentity());
 
      snapshot.put(key, values);
    } else if (snapshotValue instanceof Set) {
      final Set<OIdentifiable> values = (Set<OIdentifiable>) snapshotValue;
 
      values.add(value.getIdentity());
    } else { 
      final Set<OIdentifiable> values = new LinkedHashSet<OIdentifiable>();
 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: add
  public static final Pattern SCALAR_PATTERN = Pattern.compile("^\\d*$");
  public static final Pattern FRACTIONAL_SCALAR_PATTERN = Pattern.compile("^\\d\\.\\d*$");
  public static Set<String> TIMES = new HashSet<String>();
 
  static { 
    Scalar.TIMES.add("am");
    Scalar.TIMES.add("pm");
    Scalar.TIMES.add("morning");
    Scalar.TIMES.add("afternoon");
    Scalar.TIMES.add("evening");
    Scalar.TIMES.add("night");
  } 
 
  public Scalar(Number type) {
    super(type);
  } 
 
  public static List<Token> scan(List<Token> tokens, Options options) {
    for (int i = 0; i < tokens.size(); i++) {
      Token token = tokens.get(i);
Full Snippet Info
8
CodeRank
Related Java 8 Set Questions & Answers:
See Code Examples for Java 8 Set Methods: