/*
 * Copyright 2013 Basho Technologies Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.basho.riak.client.operations.datatypes;

import com.basho.riak.client.query.crdt.types.CrdtElement;
import com.basho.riak.client.query.crdt.types.CrdtSet;
import com.basho.riak.client.util.BinaryValue;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

public class RiakSet extends RiakDatatype<Set<byte[]>>
{

    private final CrdtSet set;

    public RiakSet(CrdtSet set)
    {
        this.set = set;
    }

    @Override
    public Set<byte[]> view()
    {
        Set<byte[]> rset = new HashSet<byte[]>();
        for (BinaryValue entry : set.viewAsSet())
        {
            rset.add(entry.getValue());
        }
        return Collections.unmodifiableSet(rset);
    }

}

@@ -657,67 +657,8 @@
 s;%0A%0A
-import com.basho.riak.client.query.crdt.types.CrdtElement;%0A
 impo
@@ -790,34 +790,8 @@
 ns;%0A
-import java.util.HashSet;%0A
 impo
@@ -855,22 +855,27 @@
 ype%3CSet%3C
-byte%5B%5D
+BinaryValue
 %3E%3E%0A%7B%0A%0A  
@@ -1006,193 +1006,35 @@
 Set%3C
-byte%5B%5D%3E view()%0A    %7B%0A        Set%3Cbyte%5B%5D%3E rset = new HashSet%3Cbyte%5B%5D%3E();%0A        for (BinaryValue entry : set.viewAsSet())%0A        %7B%0A            rset.add(entry.getValue());%0A        %7D%0A    
+BinaryValue%3E view()%0A    %7B%0A%09
     
@@ -1072,12 +1072,23 @@
 Set(
-r
 set
+.viewAsSet()
 );%0A 

Refactor RiakSet.view to return BinaryValue instead of byte[]