Example usage for java.util ArrayList contains

List of usage examples for java.util ArrayList contains

Introduction

In this page you can find the example usage for java.util ArrayList contains.

Prototype

public boolean contains(Object o) 

Source Link

Document

Returns true if this list contains the specified element.

Usage

From source file:com.osacky.penis.utils.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from   ww w .  j a  v a 2  s  .  c  om*/
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    assert responseList != null;
    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:jp.surbiton.billing_utilities.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);//w w  w .j  a  va  2  s  .  c o  m
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    while (skuList.size() > 0) {
        ArrayList<String> skuSubList = new ArrayList<String>(skuList.subList(0, Math.min(19, skuList.size())));
        skuList.removeAll(skuSubList);

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuSubList);
        Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                logDebug("getSkuDetails() failed: " + getResponseDesc(response));
                return response;
            } else {
                logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return IABHELPER_BAD_RESPONSE;
            }
        }

        ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.catreloaded.cat.iabutils.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException, NullPointerException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from   w  ww  .ja  va2 s.  co m*/
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.esri.geoevent.solutions.adapter.cot.CoTAdapterInbound.java

private String filterOutDots(String s) throws Exception {
    try {//from w w w.  ja  v  a 2  s  .c o m
        String sStageOne = s.replace("h.", "").replace("t.", "").replace("r.", "").replace("q.", "")
                .replace("o.", "");

        String[] s2 = sStageOne.trim().split(" ");

        ArrayList<String> l1 = new ArrayList<String>();
        for (String item : s2) {
            l1.add(item);

        }
        ArrayList<String> l2 = new ArrayList<String>();

        Iterator<String> iterator = l1.iterator();

        while (iterator.hasNext()) {
            String o = (String) iterator.next();
            if (!l2.contains(o))
                l2.add(o);
        }

        StringBuffer sb = new StringBuffer();
        for (String item : l2) {
            sb.append(item);
            sb.append(" ");

        }

        return sb.toString().trim().toLowerCase();
    } catch (Exception e) {
        log.error(e);
        log.error(e.getStackTrace());
        throw (e);
    }
}

From source file:com.moez.QKSMS.external.iab.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);/*from  w  ww.j  a  v a2s  .c om*/
            }
        }
    }

    if (skuList.isEmpty()) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    for (String thisResponse : responseList) {
        SkuDetails d = new SkuDetails(itemType, thisResponse);
        logDebug("Got sku details: " + d);
        inv.addSkuDetails(d);
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.nappking.movietimesup.util.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    if (mContext != null) {
        logDebug("Querying SKU details.");
        ArrayList<String> skuList = new ArrayList<String>();
        skuList.addAll(inv.getAllOwnedSkus(itemType));
        if (moreSkus != null) {
            for (String sku : moreSkus) {
                if (!skuList.contains(sku)) {
                    skuList.add(sku);//from w  ww.  j  av a  2 s  .  c o  m
                }
            }
        }

        if (skuList.size() == 0) {
            logDebug("queryPrices: nothing to do because there are no SKUs.");
            return BILLING_RESPONSE_RESULT_OK;
        }

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
        Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                logDebug("getSkuDetails() failed: " + getResponseDesc(response));
                return response;
            } else {
                logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return IABHELPER_BAD_RESPONSE;
            }
        }

        ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }
    }
    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.skilrock.lms.web.roleMgmt.common.PrivsInterceptor.java

/**
 * Determines if the request should be allowed for the action
 * //w  w  w.  ja  v a  2  s  .c  o m
 * @param request
 *            The request
 * @param action
 *            The action object
 * @return True if allowed, false otherwise
 * @throws SQLException
 */
protected boolean isAllowed(HttpServletRequest request, Object action) throws SQLException {
    String json = request.getParameter("json");
    HttpSession session = null;
    String userName = null;
    if (json != null) {
        JSONObject requestData = (JSONObject) JSONSerializer.toJSON(json);
        userName = (String) requestData.get("userName");
    }

    if (userName == null) {
        session = request.getSession();
    } else {
        Map currentUserSessionMap = (Map) LMSUtility.sc.getAttribute("LOGGED_IN_USERS");
        session = (HttpSession) currentUserSessionMap.get(userName);
    }

    // logger.debug("allowedRoles::" + allowedRoles);

    // logger.debug("i am inside priv interceptor");
    String actionName = ActionContext.getContext().getName();
    logger.debug("Action Name - " + actionName);

    boolean result = false;
    ArrayList<String> userActionList = new ArrayList<String>();
    userActionList = (ArrayList<String>) session.getAttribute("ACTION_LIST");
    logger.debug("userActionList: " + userActionList);
    List<String> disableTabs;
    UserInfoBean userBean = (UserInfoBean) session.getAttribute("USER_INFO");
    ServletContext sc = ServletActionContext.getServletContext();
    if (userBean.getUserType().equals("RETAILER") && !isSaleDuration(userBean)) {
        disableTabs = Arrays.asList(((String) sc.getAttribute("RET_SALE_BOUND")).split(","));
        for (int i = 0; i < disableTabs.size(); i++) {
            if (actionName.contains(disableTabs.get(i))) {
                saleStatus = "SALE_STOP";
                return false;
            }
        }
    }
    if (!userBean.getLoginChannel().equalsIgnoreCase("WEB")) {
        return false;
    }
    if (userActionList.contains(actionName)) {
        HashMap actionServiceMap = (HashMap) session.getAttribute("PRIV_MAP");
        Iterator itrMap = actionServiceMap.entrySet().iterator();
        while (itrMap.hasNext()) {
            Map.Entry pairs = (Map.Entry) itrMap.next();
            List privList = (List) pairs.getValue();
            for (int i = 0; i < privList.size(); i++) {

                if (((PriviledgeBean) privList.get(i)).getActionMapping().equals(actionName)) {
                    refreshSession(session);
                }
            }
        }
        result = true;
    }

    return result;
}

From source file:net.pms.dlna.DLNAMediaDatabase.java

public ArrayList<String> getStrings(String sql) {
    ArrayList<String> list = new ArrayList<String>();
    Connection conn = null;/*from   w w  w.j a  va 2s .  com*/
    ResultSet rs = null;
    PreparedStatement ps = null;
    try {
        conn = getConnection();
        ps = conn.prepareStatement(sql);
        rs = ps.executeQuery();
        while (rs.next()) {
            String str = rs.getString(1);
            if (isBlank(str)) {
                if (!list.contains(NONAME)) {
                    list.add(NONAME);
                }
            } else if (!list.contains(str)) {
                list.add(str);
            }
        }
    } catch (SQLException se) {
        logger.error(null, se);
        return null;
    } finally {
        close(rs);
        close(ps);
        close(conn);
    }
    return list;
}

From source file:com.archer.circle_run.util.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    logDebug("Querying SKU details.");
    ArrayList<String> skuList = new ArrayList<String>();
    skuList.addAll(inv.getAllOwnedSkus(itemType));
    if (moreSkus != null) {
        for (String sku : moreSkus) {
            if (!skuList.contains(sku)) {
                skuList.add(sku);//from   w w w. j a  v a2 s  .co m
            }
        }
    }

    if (skuList.size() == 0) {
        logDebug("queryPrices: nothing to do because there are no SKUs.");
        return BILLING_RESPONSE_RESULT_OK;
    }

    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
    Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        int response = getResponseCodeFromBundle(skuDetails);
        if (response != BILLING_RESPONSE_RESULT_OK) {
            logDebug("getSkuDetails() failed: " + getResponseDesc(response));
            return response;
        } else {
            logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
            return IABHELPER_BAD_RESPONSE;
        }
    }
    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    if (responseList != null)
        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }

    return BILLING_RESPONSE_RESULT_OK;
}

From source file:com.roymam.android.common.util.IabHelper.java

int querySkuDetails(String itemType, Inventory inv, List<String> moreSkus)
        throws RemoteException, JSONException {
    if (mContext != null) {
        logDebug("Querying SKU details.");
        ArrayList<String> skuList = new ArrayList<String>();
        skuList.addAll(inv.getAllOwnedSkus(itemType));
        if (moreSkus != null) {
            for (String sku : moreSkus) {
                if (!skuList.contains(sku)) {
                    skuList.add(sku);/*from  w  ww  .  j a v a 2s .c om*/
                }
            }
        }

        if (skuList.size() == 0) {
            logDebug("queryPrices: nothing to do because there are no SKUs.");
            return BILLING_RESPONSE_RESULT_OK;
        }

        Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
        Bundle skuDetails = mService.getSkuDetails(3, mContext.getPackageName(), itemType, querySkus);

        if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
            int response = getResponseCodeFromBundle(skuDetails);
            if (response != BILLING_RESPONSE_RESULT_OK) {
                logDebug("getSkuDetails() failed: " + getResponseDesc(response));
                return response;
            } else {
                logError("getSkuDetails() returned a bundle with neither an error nor a detail list.");
                return IABHELPER_BAD_RESPONSE;
            }
        }

        ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

        for (String thisResponse : responseList) {
            SkuDetails d = new SkuDetails(itemType, thisResponse);
            logDebug("Got sku details: " + d);
            inv.addSkuDetails(d);
        }
        return BILLING_RESPONSE_RESULT_OK;
    } else
        return BILLING_RESPONSE_RESULT_USER_CANCELED;
}