<p>toVector.</p>

@param objects a T object.
@param <T> a T object.
@return a {@link java.util.Vector} object.
18206
public static <T> Vector<T> toVector( T... objects )
    {
        return new Vector<T>( Arrays.asList( objects ) );
    }
1258208
public static <T extends DoubleVector> Matrix asMatrix(List<T> vectors) {
        return new ListMatrix<T>(vectors);
    }
1165484
static Vector2d getNearestVector(final Vector2d reference, final List<Vector2d> vectors) {

        if (vectors.isEmpty()) throw new IllegalArgumentException("No vectors provided");

        // to find the closest vector we find use the dot product,
        // for the general case (non-unit vectors) one can use the
        // cosine similarity
        Vector2d closest = vectors.get(0);
        double maxProd = reference.dot(closest);

        for (int i = 1; i < vectors.size(); i++) {
            double newProd = reference.dot(vectors.get(i));
            if (newProd > maxProd) {
                maxProd = newProd;
                closest = vectors.get(i);
            }
        }

        return closest;
    }
1075985
public static <T> Vector<T> getVector(int capacity, T... values) {
        return new Vector<T>() {{addAll(Arrays.asList(values));}};
    }
280789
public Vector getOIDs()
    {
        Vector v = new Vector();

        for (int i = 0; i != ordering.size(); i++)
        {
            v.addElement(ordering.elementAt(i));
        }

        return v;
    }
855376
public static List<Writable> toArrowWritablesSingle(List<FieldVector> fieldVectors,Schema schema) {
        return toArrowWritables(fieldVectors,schema).get(0);
    }
311356
public static ArrowWritableRecordBatch toArrowWritables(List<FieldVector> fieldVectors,Schema schema) {
        ArrowWritableRecordBatch arrowWritableRecordBatch = new ArrowWritableRecordBatch(fieldVectors,schema);
        return arrowWritableRecordBatch;
    }
991487
public static <T> List<T> toList( T... objects )
    {
        List<T> list = new ArrayList<T>( objects.length );
        for (T t : objects)
        {
            list.add( t );
        }
        return list;
    }
615112
public static IntegerVector immutable(IntegerVector vector) {
        if (vector == null)
            throw new NullPointerException("Cannot create an immutable " +
                                           "null vector");
        return new IntegerVectorView(vector, true);
    }
447539
public static <T extends SequenceElement> void writeSequenceVectors(@NonNull SequenceVectors<T> vectors,
                                                                        @NonNull SequenceElementFactory<T> factory, @NonNull String path) throws IOException {
        try (FileOutputStream fos = new FileOutputStream(path)) {
            writeSequenceVectors(vectors, factory, fos);
        }
    }
662059
public static List<EDBObject> convertJPAObjectsToEDBObjects(List<JPAObject> objects) {
        List<EDBObject> result = new ArrayList<EDBObject>();
        for (JPAObject object : objects) {
            result.add(convertJPAObjectToEDBObject(object));
        }
        return result;
    }
495823
@SuppressWarnings("unchecked")
    public Object transform(final Object obj) {
        if (obj != null && !(obj instanceof BeanMap)) {
            Class clazz = obj.getClass();
            if (clazz.isArray()) {
                return _transform((Object[]) obj);
            } else if (obj instanceof Map) {
                return _transform((Map) obj);
            } else if (obj instanceof List) {
                return _transform((List) obj);
            } else if (obj instanceof Set) {
                return _transform((Set) obj);
            } else if (obj instanceof Collection) {
                return _transform((Collection) obj);
            } else if (obj instanceof Iterable) {
                return _transform((Iterable) obj);
            } else if (obj instanceof Iterator) {
                return _transform((Iterator) obj);
            } else if (needTransform(obj)) {
                return onTransform(obj);
            }
        }
        return obj;
    }
1179388
public static BasicVector fromMap(Map<Integer, ? extends Number> map, int length) {
        return Vector.fromMap(map, length).to(Vectors.BASIC);
    }
744600
public <T> T convert(Object object, Class<T> clazz) {
        if (object == null) {
            return null;
        }

        return mapper.convertValue(object, clazz);
    }
311030
public static <T extends SparseDoubleVector> SparseMatrix asSparseMatrix(
            List<T> vectors, int columns) {
        return new SparseListMatrix<T>(vectors, columns);
    }
1299134
public static Map<String, Object> map(Object... objects) {

    if (objects.length % 2 != 0) {
      throw new ActivitiIllegalArgumentException("The input should always be even since we expect a list of key-value pairs!");
    }

    Map<String, Object> map = new HashMap<String, Object>();
    for (int i = 0; i < objects.length; i += 2) {
      map.put((String) objects[i], objects[i + 1]);
    }

    return map;
  }
620704
public static <T extends SequenceElement> void writeSequenceVectors(@NonNull SequenceVectors<T> vectors,
                                                                        @NonNull SequenceElementFactory<T> factory, @NonNull OutputStream stream) throws IOException {
        WeightLookupTable<T> lookupTable = vectors.getLookupTable();
        VocabCache<T> vocabCache = vectors.getVocab();

        try (PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8)))) {

            // at first line we save VectorsConfiguration
            writer.write(vectors.getConfiguration().toEncodedJson());

            // now we have elements one by one
            for (int x = 0; x < vocabCache.numWords(); x++) {
                T element = vocabCache.elementAtIndex(x);
                String json = factory.serialize(element);
                INDArray d = Nd4j.create(1);
                double[] vector = lookupTable.vector(element.getLabel()).dup().data().asDouble();
                ElementPair pair = new ElementPair(json, vector);
                writer.println(pair.toEncodedJson());
                writer.flush();
            }
        }
    }