Java Convert Object[] Array to Vector

后端 未结 6 2019
灰色年华
灰色年华 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 19:49

    1. Copy the array elements to the Vector, or

    2. Use Arrays.asList(...) to return a List, which isn't exactly a Vector, but you should be coding the List interface anyway.

提交回复
热议问题