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:it.unibo.alchemist.test.TestLanguage.java
@Test public void testMethod02() { testFileWithExplicitResult("/method02.pt", Collections.EMPTY_LIST); }
From source file:com.nextep.designer.dbgm.mergers.TableMerger.java
/** * @see com.nextep.designer.vcs.model.IMerger#doCompare(java.lang.Object, * java.lang.Object)//from ww w .j a v a2 s . com */ @SuppressWarnings("unchecked") @Override public IComparisonItem doCompare(IReferenceable source, IReferenceable target) { IComparisonItem result = new ComparisonResult(source, target, getMergeStrategy().getComparisonScope()); IBasicTable sourceTable = (IBasicTable) source; IBasicTable targetTable = (IBasicTable) target; // Map<VersionReference,IBasicColumn> srcColRefs = // hashByRef(source.getColumns()); compareName(result, sourceTable, targetTable); result.addSubItem(new ComparisonAttribute(ATTR_TEMPORARY, sourceTable == null ? null : String.valueOf(sourceTable.isTemporary()), targetTable == null ? null : String.valueOf(targetTable.isTemporary()))); result.addSubItem(new ComparisonAttribute(ATTR_SHORTNAME, sourceTable == null ? null : notNull(sourceTable.getShortName()), targetTable == null ? null : notNull(targetTable.getShortName()), ComparisonScope.REPOSITORY)); // Comparing contents listCompare(CATEGORY_COLUMNS, result, sourceTable == null ? Collections.EMPTY_LIST : sourceTable.getColumns(), targetTable == null ? Collections.EMPTY_LIST : targetTable.getColumns()); // Ordering keys List<IKeyConstraint> srcKeyList = new ArrayList<IKeyConstraint>( sourceTable == null ? Collections.EMPTY_LIST : sourceTable.getConstraints()); List<IKeyConstraint> tgtKeyList = new ArrayList<IKeyConstraint>( targetTable == null ? Collections.EMPTY_LIST : targetTable.getConstraints()); Comparator<IKeyConstraint> c = new KeyComparator(); Collections.sort(srcKeyList, c); Collections.sort(tgtKeyList, c); listCompare(CATEGORY_KEYS, result, srcKeyList, tgtKeyList); // Handling physical tables // We STOP HERE on non-repository comparison depending on the physicals // synchronization flag // if(getMergeStrategy().getComparisonScope()!=ComparisonScope.REPOSITORY // && // !SQLGenUtil.getPreferenceBool(PreferenceConstants.SYNCHRONIZE_PHYSICALS)) // { // return result; // } if (sourceTable instanceof IPhysicalObject && targetTable instanceof IPhysicalObject) { final IPhysicalObject src = (IPhysicalObject) sourceTable; final IPhysicalObject tgt = (IPhysicalObject) targetTable; final ITablePhysicalProperties srcPty = (ITablePhysicalProperties) (src == null ? null : src.getPhysicalProperties()); final ITablePhysicalProperties tgtPty = (ITablePhysicalProperties) (tgt == null ? null : tgt.getPhysicalProperties()); if (srcPty != null || tgtPty != null) { IMerger m = MergerFactory.getMerger(IElementType.getInstance(ITablePhysicalProperties.TYPE_ID), getMergeStrategy().getComparisonScope()); if (m != null) { result.addSubItem(ATTR_PHYSICAL, m.compare(srcPty, tgtPty)); } } } // returning our comparison result return result; }
From source file:io.seldon.recommendation.RecentItemsRecommender.java
@Override public ItemRecommendationResultSet recommend(String client, Long user, Set<Integer> dimensions, int maxRecsCount, RecommendationContext ctxt, List<Long> recentItemInteractions) { HashMap<Long, Double> recommendations = new HashMap<>(); Set<Long> exclusions; if (ctxt.getMode() == RecommendationContext.MODE.INCLUSION) { logger.warn("Can't run RecentItemsRecommender in inclusion context mode"); return new ItemRecommendationResultSet(name); } else {/*from w ww .j a va 2 s.c o m*/ exclusions = ctxt.getContextItems(); } if (logger.isDebugEnabled()) logger.debug("Running with dimension " + dimensions.toString()); Collection<Long> recList = itemStorage .retrieveRecentlyAddedItems(client, maxRecsCount + exclusions.size(), dimensions).getItems(); if (recList.size() > 0) { double scoreIncr = 1.0 / (double) recList.size(); int count = 0; for (Long item : recList) { if (count >= maxRecsCount) break; else if (!exclusions.contains(item)) recommendations.put(item, 1.0 - (count++ * scoreIncr)); } List<ItemRecommendationResultSet.ItemRecommendationResult> results = new ArrayList<>(); for (Map.Entry<Long, Double> entry : recommendations.entrySet()) { results.add(new ItemRecommendationResultSet.ItemRecommendationResult(entry.getKey(), entry.getValue().floatValue())); } if (logger.isDebugEnabled()) logger.debug("Recent items algorithm returned " + recommendations.size() + " items"); return new ItemRecommendationResultSet(results, name); } else { logger.warn("No items returned for recent items of dimension " + StringUtils.join(dimensions, ",") + " for " + client); } return new ItemRecommendationResultSet(Collections.EMPTY_LIST, name); }
From source file:com.github.jknack.handlebars.internal.Variable.java
/** * Creates a new {@link Variable}./*w ww. j av a 2 s .c o m*/ * * @param handlebars The handlebars instance. * @param name The variable's name. Required. * @param type The variable's type. Required. */ @SuppressWarnings("unchecked") public Variable(final Handlebars handlebars, final String name, final TagType type) { this(handlebars, name, type, Collections.EMPTY_LIST, Collections.EMPTY_MAP); }
From source file:io.seldon.clustering.recommender.ItemCategoryClusterCountsRecommender.java
@Override public ItemRecommendationResultSet recommend(String client, Long user, int dimensionId, int maxRecsCount, RecommendationContext ctxt, List<Long> recentItemInteractions) { if (ctxt.getCurrentItem() != null) { Set<Long> exclusions = Collections.emptySet(); if (ctxt.getMode() == RecommendationContext.MODE.EXCLUSION) { exclusions = ctxt.getContextItems(); }//from w w w .j a v a 2 s . c o m Integer dimId = getDimensionForAttrName(ctxt.getCurrentItem(), client, ctxt); if (dimId != null) { CountRecommender r = cUtils.getCountRecommender(client); if (r != null) { Double decayRate = ctxt.getOptsHolder().getDoubleOption(DECAY_RATE_OPTION_NAME); long t1 = System.currentTimeMillis(); Map<Long, Double> recommendations = r.recommendGlobal(dimensionId, maxRecsCount, exclusions, decayRate, dimId); long t2 = System.currentTimeMillis(); logger.debug("Recommendation via cluster counts for dimension " + dimId + " for item " + ctxt.getCurrentItem() + " for user " + user + " took " + (t2 - t1)); List<ItemRecommendationResultSet.ItemRecommendationResult> results = new ArrayList<>(); for (Map.Entry<Long, Double> entry : recommendations.entrySet()) { results.add(new ItemRecommendationResultSet.ItemRecommendationResult(entry.getKey(), entry.getValue().floatValue())); } return new ItemRecommendationResultSet(results, name); } else logger.warn("Can't get count recommender for " + client); } else logger.info("Can't get dim for item " + ctxt.getCurrentItem() + " so can't run cluster counts for dimension algorithm "); } else logger.info("Can't cluster count for category for user " + user + " client user id " + ctxt.getCurrentItem() + " as no current item passed in"); return new ItemRecommendationResultSet(Collections.EMPTY_LIST, name); }
From source file:net.sourceforge.fenixedu.presentationTier.Action.publico.SearchInquiriesResultPageDA.java
public ActionForward selectExecutionSemester(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) { SearchInquiriesResultPageDTO searchPageDTO = (SearchInquiriesResultPageDTO) actionForm; ExecutionSemester executionSemester = searchPageDTO.getExecutionSemester(); if (executionSemester == null) { return prepare(actionMapping, actionForm, request, response); }//from w w w .ja va2s . com request.setAttribute("executionCourses", Collections.EMPTY_LIST); request.setAttribute("executionDegrees", getExecutionDegrees(executionSemester)); request.setAttribute("executionSemesters", getExecutionSemesters()); return actionMapping.findForward("searchPage"); }
From source file:de.betterform.xml.xforms.ui.Item.java
public List getNodeset() { if (this.itemset != null) { List repeatNodeset = itemset.getNodeset(); int localPosition = getPosition(); return repeatNodeset.size() >= localPosition ? Collections.singletonList(repeatNodeset.get(localPosition - 1)) : Collections.EMPTY_LIST; }//from w w w. java2s. c o m return null; }
From source file:fi.vm.sade.organisaatio.business.impl.OrganisaatioTarjonta.java
private List<KoulutusHakutulosV1RDTO> getOrganisaatioKoulutukset(JsonElement organisaatioTulos) { List<KoulutusHakutulosV1RDTO> koulutukset = new ArrayList<>(); JsonElement koulutusTulokset = organisaatioTulos.getAsJsonObject().get("tulokset"); // Tarkistetaan, ett tuloksia lytyy! if (koulutusTulokset.isJsonNull()) { LOG.warn("Search failed for koulutus! --> koulutus tulokset == NULL"); return Collections.EMPTY_LIST; }/* w w w. j av a2 s . com*/ // Kydn lpi koulutukset ja deserialisoidaan JsonArray koulutusTuloksetArray = koulutusTulokset.getAsJsonArray(); for (JsonElement koulutusTulos : koulutusTuloksetArray) { KoulutusHakutulosV1RDTO hakuTulos = gson.fromJson(koulutusTulos, KoulutusHakutulosV1RDTO.class); koulutukset.add(hakuTulos); } return koulutukset; }
From source file:com.seitenbau.jenkins.plugins.dynamicparameter.BaseParameterDefinition.java
/** * Get the script result as a list.//from w w w .j a v a2s.com * @return list of values if the script returns a non-null list; * {@link Collections#EMPTY_LIST}, otherwise */ @SuppressWarnings("unchecked") public final List<Object> getScriptResultAsList(Map<String, String> parameters) { Object value = executeScript(parameters); if (value instanceof List) { return (List<Object>) value; } String name = getName(); String msg = String.format( "Script parameter with name '%s' the value is not a instance of java.util.List the parameter value is : %s", name, value); logger.info(msg); return Collections.EMPTY_LIST; }
From source file:info.magnolia.cms.util.QueryUtil.java
/** * Executes a query - if an exception is thrown, it is logged and an empty collection is * returned./*w ww . ja v a 2 s . c o m*/ * @deprecated Since 4.5.4 use search methods. */ @SuppressWarnings("unchecked") //Collections.EMPTY_LIST; public static Collection<Content> query(String repository, String statement, String language, String returnItemType, long maxResultSize) { try { return exceptionThrowingQuery(repository, statement, language, returnItemType, maxResultSize); } catch (Exception e) { log.error("can't execute query [" + statement + "], will return empty collection", e); } return Collections.EMPTY_LIST; }