如何组合两个数组

Jam*_*qba -1 java arrays

我在我的应用程序中有两个数组,在这种情况下我想在我的应用程序中组合两个数组但我尝试并失败..这是我的代码..请结合数组数据和data2:

Data[] data = {
        new Data(-79.400917f,43.661049f, "New New College Res",
                "Residence building (new concrete high-rise)", "R.drawable.mr_kun"),
        new Data(-79.394524f,43.655796f, "Baldwin Street",
                "Here be many good restaurants!", "R.drawable.mr_kun"),
        new Data(-79.402206f,43.657688f, "College St",
                "Lots of discount computer stores if you forgot a cable or need to buy hardware.", "R.drawable.mr_kun"),    
        new Data(-79.390381f,43.659878f, "Queens Park Subway",
                "Quickest way to the north-south (Yonge-University-Spadina) subway/metro line", "R.drawable.mr_kun"),

};

Data[] data2 = {
        new Data(-79.403732f,43.666801f, "Spadina Subway",
                "Quickest way to the east-west (Bloor-Danforth) subway/metro line", "R.drawable.mr_kun"),
        new Data(-79.399696f,43.667873f, "St George Subway back door",
                "Token-only admittance, else use Spadina or Bedford entrances!", "R.drawable.mr_kun"),
        new Data(-79.384163f,43.655083f, "Eaton Centre (megamall)",
                "One of the largest indoor shopping centres in eastern Canada. Runs from Dundas to Queen.", "R.drawable.mr_kun"),
};
Run Code Online (Sandbox Code Playgroud)

Ron*_*hta 5

首先转换String arrayList使用addAllmetod来添加List

ArrayList<String> first;
ArrayList<String> second;
second.addAll(first);
Run Code Online (Sandbox Code Playgroud)

  • (ノಥ益ಥ)ノ他给了你解决方案. (2认同)