Here you can find the source of arrayContains(String[] parent, String[] child)
Parameter | Description |
---|---|
parent | a parameter |
child | a parameter |
public static boolean arrayContains(String[] parent, String[] child)
//package com.java2s; //License from project: Apache License import java.util.Arrays; public class Main { /**//from ww w . ja v a 2 s . co m * test if all items in parent also appears in child child array will be sorted * * @param parent * @param child * @return */ public static boolean arrayContains(String[] parent, String[] child) { if (parent == null || parent.length == 0) { return true; } Arrays.sort(child); for (String i : parent) { if (Arrays.binarySearch(child, i) < 0) { return false; } } return true; } }