In java, how can i search String array in another String array?

后端 未结 3 752
执念已碎
执念已碎 2021-01-21 01:14

I have two different String array.

String[] str1={(ABC),(CDE),(DEF),(FGE),(ERT)};

String[] str2={(ABC),(FGE)};

I wanna know is str1 have str2\

3条回答
  •  情歌与酒
    2021-01-21 01:47

    You could search each and every element of str2 in str1. Or, more efficiently: sort str1, and use binary search.

提交回复
热议问题