@Override
    public void assign(Object o) {
        if (!checkAssign(o)) {
            return;
        }

        if (o instanceof WeightedSet) {
            WeightedSet wset = (WeightedSet) o;
            if (getDataType().equals(wset.getDataType())) {
                map.assign(wset.map);
            } else {
                throw new IllegalArgumentException("Cannot assign a weighted set of type " + wset.getDataType()
                                                   + " to a weighted set of type " + getDataType());
            }
        } else if (o instanceof Map) {
            map = new WeightedSetWrapper((Map)o, map.getDataType());
        } else {
            throw new IllegalArgumentException("Class " + o.getClass() + " not applicable to an " + this.getClass() + " instance.");
        }
    }
Creates a new weighted set with a given initial capacity.

@param initialCapacity the initial capacity to use for the encapsulated Map
document/src/main/java/com/yahoo/document/datatypes/WeightedSet.java