best way to convert an array of strings to a vector?

后端 未结 3 431
攒了一身酷
攒了一身酷 2020-12-31 19:03

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

Thanks

3条回答
  •  梦谈多话
    2020-12-31 19:48

    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 vector = new Vector(Arrays.asList(strings));
    

提交回复
热议问题