List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:com.kantenkugel.discordbot.jdocparser.JDoc.java
public static List<Documentation> get(final String name) { final String[] split = name.toLowerCase().split("[#.]"); JDocParser.ClassDocumentation classDoc; synchronized (docs) { if (!docs.containsKey(split[0])) return Collections.emptyList(); classDoc = docs.get(split[0]);/*from w w w .j a v a 2 s.c o m*/ } for (int i = 1; i < split.length - 1; i++) { if (!classDoc.subClasses.containsKey(split[i])) return Collections.emptyList(); classDoc = classDoc.subClasses.get(split[i]); } String searchObj = split[split.length - 1]; if (split.length == 1 || classDoc.subClasses.containsKey(searchObj)) { if (split.length > 1) classDoc = classDoc.subClasses.get(searchObj); return Collections.singletonList(classDoc); } else if (classDoc.classValues.containsKey(searchObj)) { return Collections.singletonList(classDoc.classValues.get(searchObj)); } else { boolean fuzzy = false; String fixedSearchObj = searchObj; if (fixedSearchObj.charAt(fixedSearchObj.length() - 1) != ')') { fixedSearchObj += "()"; fuzzy = true; } String[] methodParts = fixedSearchObj.split("[()]"); String methodName = methodParts[0]; if (classDoc.methodDocs.containsKey(methodName.toLowerCase())) { return getMethodDocs(classDoc, methodName, fixedSearchObj, fuzzy); } else if (classDoc.inheritedMethods.containsKey(methodName.toLowerCase())) { return get(classDoc.inheritedMethods.get(methodName.toLowerCase()) + '.' + searchObj); } return Collections.emptyList(); } }
From source file:br.esp.sysevent.web.ajax.InscricaoAjaxService.java
public Collection<Inscricao> findByIdGrupoIdade(final String idGrupoIdade) { if (CharSequenceUtils.isBlank(idGrupoIdade)) { return Collections.emptyList(); }/* www . j av a 2 s . c o m*/ return inscricaoService.findByIdGrupoIdade(NumberUtils.parseLong(idGrupoIdade)); }
From source file:org.hawkular.apm.server.api.utils.zipkin.SpanHttpDeriverUtil.java
/** * Method returns list of http status codes. * * @param binaryAnnotations zipkin binary annotations * @return http status codes//w w w. j a v a 2s .c o m */ public static List<HttpCode> getHttpStatusCodes(List<BinaryAnnotation> binaryAnnotations) { if (binaryAnnotations == null) { return Collections.emptyList(); } List<HttpCode> httpCodes = new ArrayList<>(); for (BinaryAnnotation binaryAnnotation : binaryAnnotations) { if (Constants.ZIPKIN_BIN_ANNOTATION_HTTP_STATUS_CODE.equals(binaryAnnotation.getKey()) && binaryAnnotation.getValue() != null) { String strHttpCode = binaryAnnotation.getValue(); Integer httpCode = toInt(strHttpCode.trim()); if (httpCode != null) { String description = EnglishReasonPhraseCatalog.INSTANCE.getReason(httpCode, Locale.ENGLISH); httpCodes.add(new HttpCode(httpCode, description)); } } } return httpCodes; }
From source file:com.alibaba.openapi.client.util.URLEncodedUtils.java
/** * Returns a list of {@link NameValuePair NameValuePairs} as built from the * URI's query portion. For example, a URI of * http://example.org/path/to/file?a=1&b=2&c=3 would return a list of three * NameValuePairs, one for a=1, one for b=2, and one for c=3. * <p>/*from www.j av a 2 s.c o m*/ * This is typically useful while parsing an HTTP PUT. * * @param uri * uri to parse * @param encoding * encoding to use while parsing the query */ public static List<NameValuePair> parse(final URI uri, final String encoding) { List<NameValuePair> result = Collections.emptyList(); final String query = uri.getRawQuery(); if (query != null && query.length() > 0) { result = new ArrayList<NameValuePair>(); parse(result, new Scanner(query), encoding); } return result; }
From source file:Main.java
public static <T> Collection<T> nullSafeCollection(Collection<T> source) { return source == null ? Collections.emptyList() : source; }
From source file:com.twentyoneechoes.borges.task.DownloadTaskHelper.java
public static List<SmbFile> getFiles(String user, String password, String path) { NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication("", user, password); Log.d("SMB SEARCHER", "lookin for files in " + path); List<SmbFile> files = Collections.emptyList(); try {/*from w w w. j av a 2 s . com*/ files = VideoUtils.getFilesFromDir(path, auth); } catch (Exception e) { e.printStackTrace(); } Log.d("SMB SEARCHER", "have files! " + files.size() + " of them! here they are: " + files); return files; }
From source file:com.facebook.stetho.inspector.protocol.module.HeapProfiler.java
@ChromeDevtoolsMethod public JsonRpcResult getProfileHeaders(JsonRpcPeer peer, JSONObject params) { ProfileHeaderResponse response = new ProfileHeaderResponse(); response.headers = Collections.emptyList(); return response; }
From source file:example.app.config.gemfire.GemFireDependsOnBeanFactoryPostProcessor.java
@SafeVarargs static <T> List<T> asList(T... array) { return (array != null ? Arrays.asList(array) : Collections.emptyList()); }
From source file:Main.java
public static List<Element> elements(Element element, Set<String> allowedTagNames) { if (element == null || !element.hasChildNodes()) { return Collections.emptyList(); }//from w ww.ja va 2s. c o m List<Element> elements = new ArrayList<Element>(); for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) { if (child.getNodeType() == Node.ELEMENT_NODE) { Element childElement = (Element) child; if (allowedTagNames.contains(child.getLocalName())) { elements.add(childElement); } } } return elements; }
From source file:bz.tsung.jsonapi4j.serialization.DataSerializer.java
@Override public void serialize(Data<Resource> data, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { Collection<Resource> list = data.get(); if (data.isToOne()) { if (list == null || list.isEmpty()) { jsonGenerator.writeObject(null); return; }//from w w w . j a v a 2 s . com jsonGenerator.writeObject(list.iterator().next()); return; } jsonGenerator.writeObject((list == null) ? Collections.emptyList() : list); }