List of usage examples for java.util List contains
boolean contains(Object o);
From source file:Main.java
/** * param String Documento XML del que queremos obtener la lista de etiquetas * @return Lista de <code>String</code> con todos los nombre de las etiquetas que tiene el documento. * Devuelve una lista vací en elcaso de que el documento no tuviera etiquetas. Si tuviera etiquetas repetidas, * solo devuelve el nombre de la etiqueta una vez. *//*from w ww . j av a 2 s . co m*/ public static List dameListaDeEtiquetas(String documento) { List listaEtiquetas = new Vector(); int posEtiqueta = documento.indexOf('<', 1); while (posEtiqueta != -1) { int finEtiqueta = documento.indexOf('>', posEtiqueta + 1); String etiqueta = documento.substring(posEtiqueta + 1, finEtiqueta); if (!listaEtiquetas.contains(etiqueta) && (etiqueta.indexOf('/') == -1)) listaEtiquetas.add(etiqueta); posEtiqueta = documento.indexOf('<', finEtiqueta); } return listaEtiquetas; }
From source file:com.google.mr4c.util.PathUtils.java
/** * Takes the elements of one path and prepends any elements that are missing in another path */// w w w . j a v a 2 s . com public static String prependMissingPathElements(String path, String otherPath, String separator) { List<String> pathElements = Arrays.asList(StringUtils.split(path, separator)); List<String> otherElements = Arrays.asList(StringUtils.split(otherPath, separator)); List<String> toAdd = new ArrayList<String>(); for (String element : otherElements) { if (!pathElements.contains(element)) { toAdd.add(element); } } List<String> newElements = new ArrayList<String>(); newElements.addAll(toAdd); newElements.addAll(pathElements); return StringUtils.join(newElements, separator); }
From source file:ee.ria.xroad.proxy.serverproxy.CustomSSLSocketFactory.java
private static void checkServerTrusted(ServiceId service, X509Certificate cert) throws Exception { if (!ServerConf.isSslAuthentication(service)) { return;/*from ww w . ja va 2 s .com*/ } log.trace("Verifying service TLS certificate..."); ClientId client = service.getClientId(); List<X509Certificate> isCerts = ServerConf.getIsCerts(client); if (isCerts.isEmpty()) { throw new Exception(String.format("Client '%s' has no IS certificates", client)); } if (isCerts.contains(cert)) { log.trace("Found matching IS certificate"); return; } log.error("Could not find matching IS certificate for client '{}'", client); throw new Exception("Server certificate is not trusted"); }
From source file:com.github.nethad.clustermeister.provisioning.dependencymanager.DependencyConfigurationUtil.java
private static void addToListIfUnique(List<File> dependencies, List<File> artifactsToPreload) { for (File artifact : dependencies) { if (!artifactsToPreload.contains(artifact)) { artifactsToPreload.add(artifact); }// w ww . ja v a 2s . c o m } }
From source file:mobile.service.SelfInfoService.java
/** * ??,???Json//from w w w .ja v a 2 s .c o m * * @param node ?Json * @return */ public static ServiceResult saveUserInfo(JsonNode node) { if (node.hasNonNull("language")) { String language = node.get("language").asText(); List<String> list = AttachmentApp.getLanguage(); if (!list.contains(language)) { return ServiceResults.illegalParameters("?language" + language); } } ObjectNodeResult result = Expert.saveExpertByJson(Context.current().session(), node); return ServiceResult.create(result); }
From source file:Main.java
public static boolean nodeMatchesAttributeFilter(Node node, String str, List<String> list) { if (str == null || list == null) { return true; }// ww w . jav a 2 s .co m NamedNodeMap attributes = node.getAttributes(); if (attributes != null) { Node namedItem = attributes.getNamedItem(str); if (namedItem != null && list.contains(namedItem.getNodeValue())) { return true; } } return false; }
From source file:Main.java
public static boolean haveGooglePlay(Context context, String packageName) { //Get PackageManager final PackageManager packageManager = context.getPackageManager(); //Get The All Install App Package Name List<PackageInfo> pInfo = packageManager.getInstalledPackages(0); //Create Name List List<String> pName = new ArrayList<String>(); //Add Package Name into Name List if (pInfo != null) { for (int i = 0; i < pInfo.size(); i++) { String pn = pInfo.get(i).packageName; pName.add(pn);//from w ww. j a v a 2s. c om } } //Check return pName.contains(packageName); }
From source file:io.cloudslang.lang.runtime.steps.AbstractExecutionData.java
private static boolean shouldBreakLoop(List<String> breakOn, ReturnValues executableReturnValues) { return breakOn.contains(executableReturnValues.getResult()); }
From source file:com.bazaarvoice.seo.sdk.util.BVUtilty.java
public static String removeBVQuery(String queryUrl) { final URI uri; try {/*from ww w . j a va 2s. c o m*/ uri = new URI(queryUrl); } catch (URISyntaxException e) { return queryUrl; } try { String newQuery = null; if (uri.getQuery() != null && uri.getQuery().length() > 0) { List<NameValuePair> newParameters = new ArrayList<NameValuePair>(); List<NameValuePair> parameters = URLEncodedUtils.parse(uri.getQuery(), Charset.forName("UTF-8")); List<String> bvParameters = Arrays.asList("bvrrp", "bvsyp", "bvqap", "bvpage"); for (NameValuePair parameter : parameters) { if (!bvParameters.contains(parameter.getName())) { newParameters.add(parameter); } } newQuery = newParameters.size() > 0 ? URLEncodedUtils.format(newParameters, Charset.forName("UTF-8")) : null; } return new URI(uri.getScheme(), uri.getAuthority(), uri.getPath(), newQuery, null).toString(); } catch (URISyntaxException e) { return queryUrl; } }
From source file:Main.java
static List<Node> children(Node parent, String childNS, String... childLocalName) { List<String> childNames = Arrays.asList(childLocalName); ArrayList<Node> result = new ArrayList<Node>(); NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (childNS.equals(child.getNamespaceURI()) && childNames.contains(child.getLocalName())) { result.add(child);/*from www.j av a 2s .co m*/ } } return result; }