List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:com.espertech.esper.epl.parse.ASTUtil.java
public static List<String> getIdentList(EsperEPL2GrammarParser.ColumnListContext ctx) { if (ctx == null || ctx.isEmpty()) { return Collections.emptyList(); }/*ww w . jav a 2 s.co m*/ List<TerminalNode> idents = ctx.IDENT(); List<String> parameters = new ArrayList<String>(idents.size()); for (TerminalNode ident : idents) { parameters.add(ident.getText()); } return parameters; }
From source file:com.groovycoder.BookRepository.java
public Collection<Book> findAll() { return Collections.emptyList(); }
From source file:com.exxonmobile.ace.hybris.storefront.controllers.util.GlobalMessages.java
public static void addMessage(final Model model, final String messageHolder, final String messageKey, final Object[] attributes) { final GlobalMessage message = new GlobalMessage(); message.setCode(messageKey);/* w w w . j a va 2 s . c o m*/ message.setAttributes(attributes != null ? Arrays.asList(attributes) : Collections.emptyList()); final Map<String, Object> modelMap = model.asMap(); if (modelMap.containsKey(messageHolder)) { final List<GlobalMessage> messages = new ArrayList<GlobalMessage>( (List<GlobalMessage>) modelMap.get(messageHolder)); messages.add(message); model.addAttribute(messageHolder, messages); } else { model.addAttribute(messageHolder, Collections.singletonList(message)); } }
From source file:com.aimluck.eip.modules.actions.project.util.ProjectTestUtil.java
public static <T> List<List<T>> devide(List<T> origin, int size) { if (origin == null || origin.isEmpty() || size <= 0) { return Collections.emptyList(); }/* w w w . j a va 2s. co m*/ int block = origin.size() / size + (origin.size() % size > 0 ? 1 : 0); List<List<T>> devidedList = new ArrayList<List<T>>(block); for (int i = 0; i < block; i++) { int start = i * size; int end = Math.min(start + size, origin.size()); devidedList.add(new ArrayList<T>(origin.subList(start, end))); } return devidedList; }
From source file:com.inkubator.securitycore.util.UserInfoUtil.java
public static List<String> getRoles() { Authentication auth = SecurityContextHolder.getContext().getAuthentication(); List<String> listAuth; if (auth != null) { listAuth = toStringList(auth.getAuthorities()); } else {/* w w w.j a va 2s .co m*/ listAuth = Collections.emptyList(); } return listAuth; }
From source file:de.hybris.platform.acceleratorstorefrontcommons.controllers.util.GlobalMessages.java
public static void addMessage(final Model model, final String messageHolder, final String messageKey, final Object[] attributes) { final GlobalMessage message = new GlobalMessage(); message.setCode(messageKey);/*w w w . ja v a 2s. co m*/ message.setAttributes(attributes != null ? Arrays.asList(attributes) : Collections.emptyList()); final Map<String, Object> modelMap = model.asMap(); if (modelMap.containsKey(messageHolder)) { final List<GlobalMessage> messages = new ArrayList<>((List<GlobalMessage>) modelMap.get(messageHolder)); messages.add(message); model.addAttribute(messageHolder, messages); } else { model.addAttribute(messageHolder, Collections.singletonList(message)); } }
From source file:org.obiba.mica.web.model.LocalizedStringDtos.java
Iterable<Mica.LocalizedStringDto> asDto( @SuppressWarnings("TypeMayBeWeakened") LocalizedString localizedString) { if (localizedString == null) return Collections.emptyList(); return localizedString.entrySet().stream().map(entry -> Mica.LocalizedStringDto.newBuilder() .setLang(entry.getKey()).setValue(entry.getValue()).build()).collect(Collectors.toList()); }
From source file:Main.java
/** * Returns a list of {@link org.apache.http.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/>/* ww w.j a v a 2 s. c o m*/ * This is typically useful while parsing an HTTP PUT. * * @param uri uri to parse */ public static List<NameValuePair> parse(final URI uri) { final String query = uri.getRawQuery(); if (!TextUtils.isEmpty(query)) { List<NameValuePair> result = new ArrayList<NameValuePair>(); Scanner scanner = new Scanner(query); parse(result, scanner); return result; } else { return Collections.emptyList(); } }
From source file:com.varaneckas.hawkscope.util.PathUtils.java
/** * Converts path separated with delimiter * @param path/*from w ww .java 2 s. c o m*/ * @param delimiter * @return */ public static List<File> pathToDirList(final String path, final String delimiter) { if (path == null || path.equals("")) { return Collections.emptyList(); } String[] locations = interpret(path).split(delimiter); final List<File> files = new ArrayList<File>(); for (final String location : locations) { final File f = new File(unsanitizePath(location)); if (!f.isDirectory()) { log.warn(f.getAbsolutePath() + " is not a directory!"); } else if (!f.canRead()) { log.warn(f.getAbsolutePath() + " can not be read!"); } else { files.add(f); } } locations = null; return files; }
From source file:cpcc.core.utils.RealVehicleUtils.java
/** * @param areaOfOperation the area of operation as a {@code String}. * @return the list of {@code LngLatAlt} depot positions. * @throws IOException in case of errors. *///from w w w . j a v a2 s. c om public static List<PolarCoordinate> getDepotPositions(String areaOfOperation) throws IOException { if (StringUtils.isBlank(areaOfOperation)) { return Collections.emptyList(); } List<PolarCoordinate> list = new ArrayList<>(); FeatureCollection fc = new ObjectMapper().readValue(areaOfOperation.replace("\\n", "\n"), FeatureCollection.class); for (Feature feature : fc.getFeatures()) { if (!"depot".equals(feature.getProperty("type"))) { continue; } GeoJsonObject geom = feature.getGeometry(); LngLatAlt coordinates = ((Point) geom).getCoordinates(); list.add(new PolarCoordinate(coordinates.getLatitude(), coordinates.getLongitude(), 0.0)); } return list; }