Adding to an ArrayList Java

后端 未结 7 1426
终归单人心
终归单人心 2020-11-28 12:24

I am a beginner to java, and need some help.

I am trying to convert an Abstract Data type Foo which is an associated list to an Arraylist of the strings B. How do yo

7条回答
  •  无人及你
    2020-11-28 13:07

    You should be able to do something like:

    ArrayList list = new ArrayList();
    for( String s : foo )
    {
        list.add(s);
    }
    

提交回复
热议问题