List of usage examples for java.util Collections EMPTY_LIST
List EMPTY_LIST
To view the source code for java.util Collections EMPTY_LIST.
Click Source Link
From source file:hr.fer.zemris.vhdllab.service.workspace.WorkspaceTest.java
@SuppressWarnings("unchecked") @Test/*w w w . j a va 2 s . co m*/ public void addFile4() { assertTrue(workspace.getFiles(firstProject).isEmpty()); File file = new File(); file.setProject(firstProject); Hierarchy hierarchy = new Hierarchy(firstProject, Collections.EMPTY_LIST); workspace.addFile(file, hierarchy); assertEquals(1, workspace.getFiles(firstProject).size()); assertEquals(hierarchy, workspace.getHierarchy(firstProject)); }
From source file:gov.nih.nci.caarray.application.project.ProjectManagementServiceTest.java
@Test public void testGetProjectsForOwner() { final User u = CaArrayUsernameHolder.getCsmUser(); final List<Project> projects = this.projectManagementService.getProjectsForOwner(u); assertSame(Collections.EMPTY_LIST, projects); }
From source file:com.streamsets.pipeline.stage.processor.xmlflattener.TestXMLFlatteningProcessor.java
@Test public void testMultipleRecords() throws Exception { String xml = "<contacts>" + getXML("0") + getXML("1") + "</contacts>"; Record expected1 = RecordCreator.create(); expected1.set(Field.create(createExpectedRecord("", "0", "", ".", "#", "", false, false))); Record expected2 = RecordCreator.create(); expected2.set(Field.create(createExpectedRecord("", "1", "", ".", "#", "", false, false))); List<Record> expected = ImmutableList.of(expected1, expected2); doTest(xml, "contact", expected, Collections.EMPTY_LIST, OnRecordError.DISCARD, true, true, false, false); }
From source file:kevin.gvmsgarch.Worker.java
private void archiveAll(String authToken, String rnrse) throws IOException, ParserConfigurationException, SAXException, XPathExpressionException, JSONException { try {//from ww w. j a va 2 s . c o m Collection<String> msgIds = Collections.EMPTY_LIST; int page = 1; int processed = 0; HashSet<String> alreadyProcessed = new HashSet<String>(); do { int numParsed = 0; do { String json = App.extractInboxJson(authToken, this.location, page); msgIds = getMessageIds(json); if (msgIds != null) { numParsed += msgIds.size(); msgIds.removeAll(alreadyProcessed); processed += msgIds.size(); if (msgIds.removeAll(getFilterIds(json, this.filter))) { this.firePropertyChange("progress", null, processed); } if (msgIds.isEmpty()) { page++; } } } while (msgIds != null && msgIds.isEmpty() && !pm.isCanceled()); if (!pm.isCanceled() && msgIds != null && msgIds.size() > 0) { archiveThese(authToken, rnrse, msgIds, mode); alreadyProcessed.addAll(msgIds); this.firePropertyChange("progress", null, processed); } } while (msgIds != null && msgIds.size() > 0 && !pm.isCanceled()); this.firePropertyChange("finish", null, null); } catch (Exception ex) { this.firePropertyChange("error", null, ex); } }
From source file:com.google.step2.AuthResponseHelper.java
/** * Returns a list of AX attribute values. * * @param alias the alias under which the attribute was requested. * @return list of attribute values.//from www .java 2 s . c om * */ public List<String> getAxFetchAttributeValues(String alias) { FetchResponse resp; try { resp = getAxFetchResponse(); } catch (MessageException e) { return Collections.EMPTY_LIST; } // when the parameter is not there, then the library returns a list of // length 1 with null as its only member. Go figure. List<String> result = resp.getAttributeValues(alias); if ((result.size() == 1) && (null == result.get(0))) { return Collections.EMPTY_LIST; } else { return result; } }
From source file:org.jfree.data.category.CategoryToPieDataset.java
/** * Returns the keys for the dataset.//from w w w. j av a2 s . c o m * <p> * If the underlying dataset is <code>null</code>, this method returns an * empty list. * * @return The keys. */ @Override public List getKeys() { List result = Collections.EMPTY_LIST; if (this.source != null) { if (this.extract == TableOrder.BY_ROW) { result = this.source.getColumnKeys(); } else if (this.extract == TableOrder.BY_COLUMN) { result = this.source.getRowKeys(); } } return result; }
From source file:com.adaptris.core.jms.MessageTypeTranslatorImp.java
@Override public List<MetadataConverter> metadataConverters() { return getMetadataConverters() != null ? getMetadataConverters() : Collections.EMPTY_LIST; }
From source file:net.pandoragames.far.ui.MimeConfParser.java
public MimeTreeNode(FileType type) { isMimeType = (type instanceof MimeType); name = type.getName();/*from www. j a va2 s. c o m*/ if (isMimeType) { nodeName = MimeConfParser.MIME_NODE_NAME; } else if (BUILDIN.FILE.name().equals(name)) { nodeName = MimeConfParser.ROOT_NODE_NAME; } else if (BUILDIN.SGML.name().equals(name) || BUILDIN.XML.name().equals(name)) { nodeName = name; } else { nodeName = name.substring(0, 1) + name.substring(1).toLowerCase(); } encoding = type.isCharsetDefined() ? type.getCharacterset() : null; fileExtensions = isMimeType ? ((MimeType) type).listFileExtensions() : Collections.EMPTY_LIST; }
From source file:jp.go.nict.langrid.serviceexecutor.google.GoogleTranslation.java
@SuppressWarnings("unchecked") private String invokeTranslation(Language sourceLang, Language targetLang, String source) throws InvalidParameterException, ProcessFailedException { InputStream is = null;//ww w. ja v a2 s.com try { URLConnection con = new URL(TRANSLATE_URL).openConnection(); con.setDoOutput(true); con.setReadTimeout(timeoutMillis); con.addRequestProperty("Referer", referer); writeParameters(con, sourceLang, targetLang, source); is = con.getInputStream(); String json = StreamUtil.readAsString(is, CharsetUtil.newUTF8Decoder()); try { TranslationResult result = JSON.decode(json, TranslationResult.class); ResponseData responseData = result.responseData; int status = result.responseStatus; String key = sourceLang.getCode() + ":" + targetLang.getCode(); if (status == 200) { langPairCache.putInCache(key, true); return StringEscapeUtils.unescapeHtml(responseData.translatedText.replaceAll("'", "'")); } else { String details = result.responseDetails; if (details.equals("invalid translation language pair")) { langPairCache.putInCache(key, false); languagePairValidator.get().getUniqueLanguagePair(Collections.EMPTY_LIST); } throw new ProcessFailedException(result.responseStatus + ": " + details); } } catch (JSONException e) { String message = "failed to read translated text: " + json; logger.log(Level.WARNING, message, e); throw new ProcessFailedException(message); } } catch (IOException e) { logger.log(Level.SEVERE, "failed to execute service.", e); throw new ProcessFailedException(e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { } } } }
From source file:cz.zcu.kiv.eegdatabase.wui.ui.experiments.forms.wizard.AddExperimentEnvironmentForm.java
private void addWeather() { ChoiceRenderer<Weather> renderer = new ChoiceRenderer<Weather>("title", "weatherId"); LoadableListModel<Weather> choiceModel = new LoadableListModel<Weather>() { private static final long serialVersionUID = 1L; @Override//from ww w . java 2 s . c om protected List<Weather> load() { Experiment experiment2 = model.getObject(); ResearchGroup researchGroup = experiment2.getResearchGroup(); if (researchGroup != null) return weatherFacade.getRecordsByGroup(researchGroup.getResearchGroupId()); else return Collections.EMPTY_LIST; } }; DropDownChoice<Weather> weather = new DropDownChoice<Weather>("weather", new PropertyModel<Weather>(model.getObject(), "weather"), choiceModel, renderer); weather.setLabel(ResourceUtils.getModel("label.weather")); weather.setRequired(true); final FeedbackPanel feedback = createFeedbackForComponent(weather, "weatherFeedback"); add(weather); add(feedback); }