Java Convert Object[] Array to Vector

后端 未结 6 2021
灰色年华
灰色年华 2020-12-16 19:21

What\'s the best way to convert an Object array to a Vector?

JDE < 1.5

public Vector getListElements()
{
  Vector myVector = this.elements;
  retu         


        
6条回答
  •  粉色の甜心
    2020-12-16 20:10

    A reasonably concise way to do it is something like:

    Object[] xx = { 1, "cat", new Point(100,200) };
    Vector vv = new Vector(Arrays.asList(xx));
    System.out.println("vv=="+vv.toString());
    

    But y'all knew that already, I guess.

提交回复
热议问题