Clones the given collection.

@param collDef The collection descriptor
@param prefix  A prefix for the name
@return The cloned collection
557859
private CollectionDescriptorDef cloneCollection(CollectionDescriptorDef collDef, String prefix)
    {
        CollectionDescriptorDef copyCollDef = new CollectionDescriptorDef(collDef, prefix);

        copyCollDef.setOwner(this);
        // we remove properties that are only relevant to the class the features are declared in
        copyCollDef.setProperty(PropertyHelper.OJB_PROPERTY_IGNORE, null);

        Properties mod = getModification(copyCollDef.getName());

        if (mod != null)
        {
            if (!PropertyHelper.toBoolean(mod.getProperty(PropertyHelper.OJB_PROPERTY_IGNORE), false) &&
                hasFeature(copyCollDef.getName()))
            {
                LogHelper.warn(true,
                               ClassDescriptorDef.class,
                               "process",
                               "Class "+getName()+" has a feature that has the same name as its included collection "+
                               copyCollDef.getName()+" from class "+collDef.getOwner().getName()); 
            }
            copyCollDef.applyModifications(mod);
        }
        return copyCollDef;
    }
996294
@Override
    public RuleBasedCollator cloneAsThawed() {
        try {
            RuleBasedCollator result = (RuleBasedCollator) super.clone();
            // since all collation data in the RuleBasedCollator do not change
            // we can safely assign the result.fields to this collator 
            // except in cases where we can't
            result.settings = settings.clone();
            result.collationBuffer = null;
            result.frozenLock = null;
            return result;
        } catch (CloneNotSupportedException e) {
            // Clone is implemented
            return null;
        }
    }
748628
public static <T> T cloneObjectWithParents (T t) throws IllegalAccessException, InstantiationException {
        T clone = (T) t.getClass().newInstance();

        List<Field> allFields = new ArrayList<>();

        Class parentClass = t.getClass().getSuperclass();

        while (parentClass != null) {
            Collections.addAll(allFields, parentClass.getDeclaredFields());
            parentClass = parentClass.getSuperclass();
        }

        Collections.addAll(allFields, t.getClass().getDeclaredFields());

        for (Field field : allFields) {
            int modifiers = field.getModifiers();
            //We skip final and static fields
            if ((Modifier.FINAL & modifiers) != 0 || (Modifier.STATIC & modifiers) != 0) {
                continue;
            }
            field.setAccessible(true);

            Object value = field.get(t);

            if (Collection.class.isAssignableFrom(field.getType())) {
                Collection collection = (Collection) field.get(clone);
                if (collection == null) {
                    collection = (Collection) field.get(t).getClass().newInstance();
                }
                collection.addAll((Collection) field.get(t));
                value = collection;
            } else if (Map.class.isAssignableFrom(field.getType())) {
                Map clonMap = (Map) field.get(t).getClass().newInstance();
                clonMap.putAll((Map) field.get(t));
                value = clonMap;
            }
            field.set(clone, value);
        }

        return clone;
    }
20115
public static InsnList cloneList(InsnList list)
	{
		InsnList clone = new InsnList();
		ListIterator<AbstractInsnNode> it = list.iterator();
		while (it.hasNext())
			clone.add(it.next().clone(Collections.emptyMap()));

		return clone;
	}
167416
public SchemaColumn copyAndReplaceWithTVE(int colIndex) {
        TupleValueExpression newTve;
        if (m_expression instanceof TupleValueExpression) {
            newTve = (TupleValueExpression) m_expression.clone();
            newTve.setColumnIndex(colIndex);
        }
        else {
            newTve = new TupleValueExpression(m_tableName, m_tableAlias,
                    m_columnName, m_columnAlias,
                    m_expression, colIndex);
        }
        return new SchemaColumn(m_tableName, m_tableAlias,
                m_columnName, m_columnAlias,
                newTve, m_differentiator);
    }
914350
public static <T> List<T> sortedCollection(Collection<T> coll) {
	List<T> list = new LinkedList<T>(coll);
	Collections.sort(list, new UComp<T>());
	return list;
    }
1304913
def duplicates(coll):
    
    return list(set(x for x in coll if coll.count(x) > 1))
595832
private void createUniqueIndexGFS(DBCollection coll, String id)
    {
        try
        {
            coll.createIndex(new BasicDBObject("metadata." + id, 1), new BasicDBObject("unique", true));
        }
        catch (MongoException ex)
        {
            throw new KunderaException("Error in creating unique indexes in " + coll.getFullName() + " collection on "
                    + id + " field");
        }
    }
273674
public static double[] doubleArrayCopyOf(CollectionNumber coll) {
        double[] data = new double[coll.size()];
        IteratorNumber iter = coll.iterator();
        int index = 0;
        while (iter.hasNext()) {
            data[index] = iter.nextDouble();
            index++;
        }
        return data;
    }
265159
function cloneRelayHandleSourceField(
  handleField: NormalizationLinkedHandle,
  selections: $ReadOnlyArray<NormalizationSelection>,
  variables: Variables,
): NormalizationLinkedField {
  const sourceField = selections.find(
    source =>
      source.kind === LINKED_FIELD &&
      source.name === handleField.name &&
      source.alias === handleField.alias &&
      areEqual(source.args, handleField.args),
  );
  invariant(
    sourceField && sourceField.kind === LINKED_FIELD,
    'cloneRelayHandleSourceField: Expected a corresponding source field for ' +
      'handle `%s`.',
    handleField.handle,
  );
  const handleKey = getHandleStorageKey(handleField, variables);
  const clonedField = {
    ...sourceField,
    args: null,
    name: handleKey,
    storageKey: handleKey,
  };
  return clonedField;
}
1185379
function cloneListForMapAndSample(original, excludeDimensions) {
    var allDimensions = original.dimensions;
    var list = new List(
        zrUtil.map(allDimensions, original.getDimensionInfo, original),
        original.hostModel
    );
    // FIXME If needs stackedOn, value may already been stacked
    transferProperties(list, original);

    var storage = list._storage = {};
    var originalStorage = original._storage;

    // Init storage
    for (var i = 0; i < allDimensions.length; i++) {
        var dim = allDimensions[i];
        if (originalStorage[dim]) {
            // Notice that we do not reset invertedIndicesMap here, becuase
            // there is no scenario of mapping or sampling ordinal dimension.
            if (zrUtil.indexOf(excludeDimensions, dim) >= 0) {
                storage[dim] = cloneDimStore(originalStorage[dim]);
                list._rawExtent[dim] = getInitialExtent();
                list._extent[dim] = null;
            }
            else {
                // Direct reference for other dimensions
                storage[dim] = originalStorage[dim];
            }
        }
    }
    return list;
}
245985
public static RAExpression crossJoin(RAExpression re1, RAExpression re2, TermFactory termFactory) throws IllegalJoinException {

        RAExpressionAttributes attributes =
                RAExpressionAttributes.crossJoin(re1.attributes, re2.attributes);

        return new RAExpression(union(re1.dataAtoms, re2.dataAtoms),
                union(re1.filterAtoms, re2.filterAtoms), attributes, termFactory);
    }
877369
public static String[] generateUniqueIdCache(String prefix, int count)
    {
        String[] cache = new String[count];
        SectionUniqueIdCounter counter = new SectionUniqueIdCounter(prefix);
        for (int i = 0; i < count ; i++)
        {
            cache[i] = counter.generateUniqueId();
        }
        return cache;
    }
1091852
public String joinEx(Object collection, String delim, String prefix, String suffix) {
		if (collection == null) {
			return StringUtils.collectionToDelimitedString(Collections.emptyList(), delim, prefix, suffix);
		} else if (collection instanceof Collection) {
			return StringUtils.collectionToDelimitedString((Collection<?>) collection, delim, prefix, suffix);
		} else if (collection.getClass().isArray()) {
			return StringUtils.collectionToDelimitedString(CollectionUtils.arrayToList(collection), delim, prefix, suffix);
		} else {
			return StringUtils.collectionToDelimitedString(Collections.singletonList(collection), delim, prefix, suffix);
		}
	}
638614
function cloneItree(itree, excludeKeys) {
    const clone = {};
    excludeKeys = _.castArray(excludeKeys);
    excludeKeys.push('ref');

    _.each(itree, (v, k) => {
        if (!_.includes(excludeKeys, k)) {
            clone[k] = _.cloneDeep(v);
        }
    });

    return clone;
}
214199
function clone(candidate)
{
  var copy;

  if (typeOf(candidate) == 'array')
  {
    copy = [].concat(candidate);
  }
  else if (typeOf(candidate) == 'object')
  {
    copy = extend(candidate);
  }
  else
  {
    copy = candidate;
  }

  return copy;
}
1370104
public static RAExpressionAttributes alias(RAExpressionAttributes re, RelationID alias) {

        ImmutableMap<QuotedID, Term> unqualifiedAttributes =
                re.attributes.entrySet().stream()
                        .filter(e -> e.getKey().getRelation() == null)
                        .collect(ImmutableCollectors.toMap(
                                e -> e.getKey().getAttribute(), Map.Entry::getValue));

        return create(unqualifiedAttributes, alias);
    }