Code example for TreeSet

Methods: add

0
    @Test(expected = ModelException.class) 
    public void testCreateUniqueKeyWithSameNameAsAnotherUniqueKey() throws ModelException { 
        SortedSet<CharSequence> cols1 = new TreeSet<CharSequence>();
        cols1.add("test_uk1");
        cols1.add("test_uk2");
        SortedSet<CharSequence> cols2 = new TreeSet<CharSequence>();
        cols2.add("test_data");
        new UniqueKeyImpl("uk_test", cols1, table);
        new UniqueKeyImpl("uk_test", cols2, table);
    } 
     
    public static SortedSet<ColumnNameImpl> convertToColumnName(SortedSet<? extends CharSequence> names) throws ModelException {
        SortedSet<ColumnNameImpl> dbNames = new TreeSet<ColumnNameImpl>();
        if (names != null) {
            for (CharSequence name : names) {
                dbNames.add(new ColumnNameImpl(name));
            } 
        }  
        return dbNames;
    }