1 /*******************************************************************************
2 * Copyright 2016-2017 ZTE, Inc. and others.
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 * in compliance with the License. You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software distributed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 * or implied. See the License for the specific language governing permissions and limitations under
13 ******************************************************************************/
14 package org.onap.msb.apiroute.wrapper.util;
16 import java.util.HashSet;
19 import org.apache.commons.lang3.StringUtils;
21 public class CommonUtil {
23 public static final int SC_OK = 200;
25 public static Object[] concat(Object[] a, Object[] b) {
26 Object[] c = new Object[a.length + b.length];
27 System.arraycopy(a, 0, c, 0, a.length);
28 System.arraycopy(b, 0, c, a.length, b.length);
32 public static boolean contain(String strArray, String str) {
33 String[] array = StringUtils.split(strArray, ",");
34 return contain(array, str);
37 public static boolean contain(String[] array, String str) {
38 for (int i = 0; i < array.length; i++) {
39 if (array[i].trim().equals(str)) {
47 public static boolean contain(String[] array, String value[]) {
48 for (int i = 0; i < array.length; i++) {
49 for (int n = 0; n < value.length; n++) {
50 if (array[i].equals(value[n])) {
62 * @Description TODO(Extract the list1 and list2 different data sets)
65 * @return TODO(a new List in list2 but not in list1)
66 * @return List<String>
68 public static <T> Set<T> getDiffrent(Set<T> list1, Set<T> list2) {
70 HashSet<T> set_all = new HashSet<T>();
77 Set<T> diff = new HashSet<T>();
80 if (set_all.add(t2)) { // in list2 but not in list1