到字符串数组转换为矢量最佳方式? [英] best way to convert an array of strings to a vector?

查看:93
本文介绍了到字符串数组转换为矢量最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如标题所暗示的,什么是字符串数组转换为载体的最佳方法是什么?

As the title suggests, what is the best method for converting an array of strings to a vector?

感谢

推荐答案

呼叫向量的使用现有的集合(阵列,在这种情况下)的构造函数初始化自己:

Call the constructor of Vector that uses an existing collection (your array, in this case) to initialize itself:

String[] strings = { "Here", "Are", "Some", "Strings" };
Vector<String> vector = new Vector<String>(Arrays.asList(strings));

这篇关于到字符串数组转换为矢量最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆