List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:ch.cyberduck.core.s3.S3LocationFeature.java
@Override public Set<Name> getLocations() { // Only for AWS if (session.getHost().getHostname().endsWith(PreferencesFactory.get().getProperty("s3.hostname.default"))) { return session.getHost().getProtocol().getRegions(); }/*w w w . ja v a2s.c o m*/ return Collections.emptySet(); }
From source file:nu.yona.server.goals.service.GoalService.java
public Set<GoalDto> getGoalsOfUser(UUID forUserId) { UserDto user = userService.getPrivateUser(forUserId); return user.getOwnPrivateData().getGoals().orElse(Collections.emptySet()); }
From source file:Main.java
/** * Creates an unmodifiable shallow copy of the given original {@link Set}. <p> While the copy returns an immutable * copy of the {@link Set} the content is not cloned in any way. Unless the content is immutable by itself the * result is not fully immutable. In the shallow copy all references are the same as in the original {@link Set}! * </p>/* w w w. j av a 2 s. c o m*/ * * @param original The {@link Set} to copy the elements fro. * @param <E> The type of the elements * * @return Returns an immutable (unmodifiable) copy of the original {@link Set} with all the elements added but not * cloned! */ public static <E> Set<E> createUnmodifiableShallowCopy(final Set<E> original) { if (original == null || original.isEmpty()) { return Collections.emptySet(); } else { return Collections.unmodifiableSet(new HashSet<E>(original)); } }
From source file:io.seldon.clustering.recommender.GlobalClusterCountsRecommender.java
@Override public ItemRecommendationResultSet recommend(String client, Long user, int dimensionId, int maxRecsCount, RecommendationContext ctxt, List<Long> recentItemInteractions) { CountRecommender r = cUtils.getCountRecommender(client); if (r != null) { long t1 = System.currentTimeMillis(); //RECENT ACTIONS Set<Long> exclusions = Collections.emptySet(); if (ctxt.getMode() == RecommendationContext.MODE.EXCLUSION) { exclusions = ctxt.getContextItems(); }/*from ww w .jav a 2 s. c om*/ Double decayRate = ctxt.getOptsHolder().getDoubleOption(DECAY_RATE_OPTION_NAME); Map<Long, Double> recommendations = r.recommendGlobal(dimensionId, maxRecsCount, exclusions, decayRate, null); long t2 = System.currentTimeMillis(); logger.debug("Recommendation via cluster counts 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 { return new ItemRecommendationResultSet( Collections.<ItemRecommendationResultSet.ItemRecommendationResult>emptyList(), name); } }
From source file:com.qcadoo.mes.basic.shift.WorkingHours.java
private Set<TimeRange> parseIntervals(final String hoursRanges) { if (StringUtils.isBlank(hoursRanges)) { return Collections.emptySet(); }/*from www.j a v a 2s . c om*/ String trimmedHoursRanges = StringUtils.remove(hoursRanges, ' '); if (!WORKING_HOURS_PATTERN.matcher(trimmedHoursRanges).matches()) { throw new IllegalArgumentException( String.format("Invalid shift's work time definition format: %s", hoursRanges)); } final Set<TimeRange> intervals = Sets.newHashSet(); for (String hoursRange : StringUtils.split(trimmedHoursRanges, ',')) { TimeRange interval = stringToInterval(hoursRange); if (interval != null) { intervals.add(interval); } } return intervals; }
From source file:org.osiam.security.authentication.OsiamClientDetails.java
/** * Get a set of resource id's. * * @return always empty */ @Override public Set<String> getResourceIds() { return Collections.emptySet(); }
From source file:io.seldon.clustering.recommender.BaseItemClusterCountsRecommender.java
ItemRecommendationResultSet recommend(String recommenderName, String recommenderType, String client, Long user, int dimensionId, int maxRecsCount, RecommendationContext ctxt) { RecommendationContext.OptionsHolder optionsHolder = ctxt.getOptsHolder(); if (ctxt.getCurrentItem() != null) { Set<Long> exclusions = Collections.emptySet(); if (ctxt.getMode() == RecommendationContext.MODE.EXCLUSION) { exclusions = ctxt.getContextItems(); }//from w w w .ja va2 s. c om CountRecommender r = cUtils.getCountRecommender(client); if (r != null) { long t1 = System.currentTimeMillis(); Integer minClusterItems = optionsHolder.getIntegerOption(MIN_ITEMS_FOR_VALID_CLUSTER_OPTION_NAME); Double decayRate = optionsHolder.getDoubleOption(DECAY_RATE_OPTION_NAME); String clusterAlgorithm = optionsHolder.getStringOption(CLUSTER_ALG_OPTION_NAME); Map<Long, Double> recommendations = r.recommendUsingItem(recommenderType, ctxt.getCurrentItem(), dimensionId, maxRecsCount, exclusions, decayRate, clusterAlgorithm, minClusterItems); long t2 = System.currentTimeMillis(); logger.debug("Recommendation via cluster counts 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, recommenderName); } else { return new ItemRecommendationResultSet( Collections.<ItemRecommendationResultSet.ItemRecommendationResult>emptyList(), recommenderName); } } else { logger.info("Can't cluster count for item for user " + user + " as no current item passed in"); return new ItemRecommendationResultSet( Collections.<ItemRecommendationResultSet.ItemRecommendationResult>emptyList(), recommenderName); } }
From source file:org.arrow.model.event.intermediate.AbstractIntermediateEvent.java
public Set<Flow> getOutgoingFlows() { if (outgoingFlows == null && outgoingLinkFlows == null) { return Collections.emptySet(); }//from ww w. j a va 2 s . com Set<Flow> flows = new HashSet<>(); flows.addAll(outgoingFlows); flows.addAll(outgoingLinkFlows); return flows; }
From source file:com.netflix.spinnaker.fiat.providers.DefaultServiceAccountProvider.java
@Override public Set<ServiceAccount> getAllUnrestricted() throws ProviderException { return Collections.emptySet(); }
From source file:org.trustedanalytics.servicecatalog.security.JwtUserDetailsTokenConverter.java
@SuppressWarnings("unchecked") private Collection<? extends GrantedAuthority> getAuthorities(Map<String, ?> map) { if (!map.containsKey(SCOPE)) { return Collections.emptySet(); }//from w w w . j a v a 2 s .com return ((Collection<String>) map.get(SCOPE)).stream().map(v -> new SimpleGrantedAuthority(v)) .collect(Collectors.toSet()); }