List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:com.devicehive.dao.riak.model.RiakDeviceEquipment.java
public static List<RiakDeviceEquipment> convertToEntity(List<DeviceEquipmentVO> equipment) { if (equipment == null) { return Collections.emptyList(); }/*from w w w. j av a 2 s.com*/ return equipment.stream().map(RiakDeviceEquipment::convertToEntity).collect(Collectors.toList()); }
From source file:net.daboross.bukkitdev.skywars.util.CrossVersion.java
/** * Supports Bukkit earlier than... 1.8?/*from w w w . jav a 2s . c om*/ */ public static Collection<? extends Player> getOnlinePlayers(Server s) { try { return s.getOnlinePlayers(); } catch (NoSuchMethodError ignored) { Class<? extends Server> theClass = s.getClass(); try { for (Method method : theClass.getMethods()) { if ("getOnlinePlayers".equals(method.getName()) && method.getParameterTypes().length == 0 && method.getReturnType().isArray()) { return Arrays.asList((Player[]) method.invoke(s)); } } } catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { SkyStatic.getLogger().log(Level.WARNING, "Couldn't use fallback .getOnlinePlayers method of Server! Acting as if there are no online players!!", ex); } SkyStatic.getLogger().log(Level.WARNING, "Couldn't find old fallback .getOnlinePlayers method of Server! Acting as if there are no online players!!"); } return Collections.emptyList(); }
From source file:org.jspringbot.keyword.expression.ELRunKeyword.java
public static Object runKeyword(String keyword) { return doPythonExec(keyword, Collections.emptyList()); }
From source file:ca.uhn.fhir.model.dstu.resource.Binary.java
@Override public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) { return Collections.emptyList(); }
From source file:io.cloudslang.lang.runtime.bindings.ArgumentsBindingTest.java
@Test public void testEmptyBindArguments() throws Exception { List<Argument> arguments = Collections.emptyList(); Map<String, Serializable> result = bindArguments(arguments); Assert.assertTrue(result.isEmpty()); }
From source file:com.netflix.spinnaker.echo.artifacts.DockerHubArtifactExtractor.java
@Override public List<Artifact> getArtifacts(String source, Map payload) { WebhookEvent webhookEvent = objectMapper.convertValue(payload, WebhookEvent.class); Repository repository = webhookEvent.getRepository(); PushData pushData = webhookEvent.getPushData(); if (repository == null || pushData == null) { log.warn("Malformed push data from dockerhub: {}", payload); return Collections.emptyList(); }/*from ww w.ja va 2s. c o m*/ String name = String.format("index.docker.io/%s", repository.getRepoName()); String version = pushData.getTag(); Map<String, Object> metadata = new ImmutableMap.Builder<String, Object>() .put("pusher", pushData.getPusher() != null ? pushData.getPusher() : "").build(); return Collections.singletonList( Artifact.builder().type("docker/image").reference(String.format("%s:%s", name, version)).name(name) .version(version).provenance(webhookEvent.getCallbackUrl()).metadata(metadata).build()); }
From source file:com.homeadvisor.kafdrop.controller.ClusterController.java
@ExceptionHandler(BrokerNotFoundException.class) private String brokerNotFound(Model model) { model.addAttribute("zookeeper", zookeeperProperties); model.addAttribute("brokers", Collections.emptyList()); model.addAttribute("topics", Collections.emptyList()); return "cluster-overview"; }
From source file:org.openlmis.fulfillment.service.referencedata.OrderableReferenceDataService.java
/** * Finds orderables by their ids./* ww w. j a va2 s .com*/ * * @param ids ids to look for. * @return a page of orderables */ public List<OrderableDto> findByIds(Collection<UUID> ids) { if (CollectionUtils.isEmpty(ids)) { return Collections.emptyList(); } return getPage(RequestParameters.init().set("id", ids)).getContent(); }
From source file:edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForObjectProperties.java
@Override public List<String> findAdditionalURIsToIndex(Statement stmt) { if (stmt == null) return Collections.emptyList(); if (stmt.getObject().isLiteral()) return doDataPropertyStmt(stmt); else//from www. ja v a 2 s .c o m return doObjectPropertyStmt(stmt); }
From source file:de.micromata.genome.db.jpa.history.impl.CollectionPropertyConverter.java
@Override public List<HistProp> convert(IEmgr<?> emgr, HistoryMetaInfo historyMetaInfo, Object entity, ColumnMetadata pd) {/*from w ww.j a v a2s .c om*/ Collection<?> col = (Collection<?>) pd.getGetter().get(entity); if (col == null) { return Collections.emptyList(); } EntityMetadata targetEntity = pd.getTargetEntity(); if (col.isEmpty() == true) { HistProp hp = new HistProp(); hp.setName(""); if (targetEntity != null) { hp.setType(targetEntity.getJavaType().getName()); } else { hp.setType(col.getClass().getName()); } hp.setValue(""); return Collections.singletonList(hp); } if (targetEntity != null) { List<Object> pks = new ArrayList<>(); for (Object ob : col) { Object pk = targetEntity.getIdColumn().getGetter().get(ob); if (pk == null) { LOG.warn("Unsaved entity in history"); return Collections.emptyList(); } pks.add(pk); } String sval = StringUtils.join(pks, ','); HistProp hp = new HistProp(); hp.setName(""); hp.setType(targetEntity.getJavaType().getName()); hp.setValue(sval); return Collections.singletonList(hp); } Map<Long, Class<?>> pkSet = new TreeMap<>(); int idx = 0; for (Object ob : col) { if ((ob instanceof DbRecord) == false) { LOG.warn("Cannot create collection history on non DbRecord: " + entity.getClass().getName() + "." + pd.getName() + "[" + idx + "]" + ob.getClass().getName()); continue; } DbRecord<?> rec = (DbRecord<?>) ob; Long lp = rec.getPkAsLong(); if (lp == null) { LOG.warn("History; Unsafed PK in history: " + entity.getClass().getName() + "." + pd.getName() + "[" + idx + "]" + ob.getClass().getName()); continue; } pkSet.put(lp, ob.getClass()); ++idx; } idx = 0; List<HistProp> hpret = new ArrayList<>(); for (Map.Entry<Long, Class<?>> me : pkSet.entrySet()) { HistProp hp = new HistProp(); hp.setName(me.getValue().toString()); hp.setType(col.getClass().getName() + "<" + me.getValue().getName() + ">"); hp.setValue(me.getValue().toString()); hpret.add(hp); ++idx; } return hpret; }