List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:com.hp.autonomy.searchcomponents.hod.parametricvalues.HodParametricValuesService.java
@Override @Cacheable(CacheNames.PARAMETRIC_VALUES) public Set<QueryTagInfo> getAllParametricValues(final HodParametricRequest parametricRequest) throws HodErrorException { final Collection<String> fieldNames = new HashSet<>(); fieldNames.addAll(parametricRequest.getFieldNames()); if (fieldNames.isEmpty()) { fieldNames.addAll(fieldsService.getParametricFields(new HodFieldsRequest.Builder() .setDatabases(parametricRequest.getQueryRestrictions().getDatabases()).build())); }/*from w w w.j av a 2s .c o m*/ final Set<QueryTagInfo> results; if (fieldNames.isEmpty()) { results = Collections.emptySet(); } else { final ResourceIdentifier queryProfile = parametricRequest.isModified() ? getQueryProfile() : null; final GetParametricValuesRequestBuilder parametricParams = new GetParametricValuesRequestBuilder() .setQueryProfile(queryProfile).setSort(ParametricSort.document_count) .setText(parametricRequest.getQueryRestrictions().getQueryText()) .setFieldText(parametricRequest.getQueryRestrictions().getFieldText()) .setMaxValues(parametricRequest.getMaxValues()); final FieldNames parametricFieldNames = getParametricValuesService.getParametricValues(fieldNames, new ArrayList<>(parametricRequest.getQueryRestrictions().getDatabases()), parametricParams); final Set<String> fieldNamesSet = parametricFieldNames.getFieldNames(); results = new HashSet<>(); for (final String name : fieldNamesSet) { final Set<QueryTagCountInfo> values = new HashSet<>( parametricFieldNames.getValuesAndCountsForFieldName(name)); if (!values.isEmpty()) { results.add(new QueryTagInfo(name, values)); } } } return results; }
From source file:com.kildeen.visor.core.api.permission.DefaultPermissionConverter.java
@Override public Set<Permission> deserializeAll(final Collection<String> deserialized) { if (CollectionUtils.isNotEmpty(deserialized)) { Set<Permission> deserializedPermissions = new ListOrderedSet<>(); for (String permission : deserialized) { deserializedPermissions.add(deserialize(permission)); }/*w ww. j a v a 2 s .c o m*/ return deserializedPermissions; } else { return Collections.emptySet(); } }
From source file:com.griddynamics.jagger.monitoring.reporting.SystemUnderTestPlotsGeneralProvider.java
@Override public JRDataSource getDataSource(String groupName) { log.debug("Report for param group with name {} requested", groupName); if (!this.enable) { return new JRBeanCollectionDataSource(Collections.emptySet()); }//ww w . j av a 2 s .c o m if (taskPlots == null) { log.debug("Initing task plots"); taskPlots = createTaskPlots(); } loadMonitoringMap(); log.debug("Loading data for task id {}", groupName); List<MonitoringReporterData> data = taskPlots.get(groupName); if (data == null) { log.debug("Data not found for task {}", groupName); String monitoringTaskId = relatedMonitoringTask(groupName); log.debug("Related task {}", monitoringTaskId); data = taskPlots.get(monitoringTaskId); } if (data == null) { log.warn("SuT plots not found for task with id {}", groupName); log.warn("Check that MonitoringAggregator is configured!!!"); } return new JRBeanCollectionDataSource(data); }
From source file:com.ge.predix.acs.service.policy.matcher.PolicyMatcherImplTest.java
@BeforeClass public void setup() { this.policyMatcher = new PolicyMatcherImpl(); MockitoAnnotations.initMocks(this); when(this.attributeReaderFactory.getResourceAttributeReader()) .thenReturn(this.defaultResourceAttributeReader); when(this.attributeReaderFactory.getSubjectAttributeReader()) .thenReturn(this.defaultSubjectAttributeReader); when(this.defaultResourceAttributeReader.getAttributes(anyString())).thenReturn(Collections.emptySet()); BaseSubject subject = new BaseSubject("test-subject"); subject.setAttributes(new HashSet<>()); when(this.defaultSubjectAttributeReader.getAttributesByScope(anyString(), anySetOf(Attribute.class))) .thenReturn(subject.getAttributes()); }
From source file:py.una.pol.karaku.replication.client.ReplicationLogic.java
/** * @return/*from ww w .ja v a 2s .com*/ */ @Override @Transactional public Set<ReplicationInfo> getReplicationsToDo() { List<ReplicationInfo> loaded = dao.getAll(getBaseWhere(), getSearchParam()); if (loaded == null) { return Collections.emptySet(); } Set<ReplicationInfo> toRet = new HashSet<ReplicationInfo>(loaded.size()); for (ReplicationInfo ri : loaded) { Calendar now = dateProvider.getNowCalendar(); if (now.after(getNextSync(ri))) { toRet.add(loadClass(ri)); } } return toRet; }
From source file:com.scvngr.levelup.core.model.util.JsonUtilsTest.java
/** * Tests {@link com.scvngr.levelup.core.model.util.JsonUtils#optIntegerSet(org.json.JSONObject, String)}. * * @throws org.json.JSONException if there's a parse error. *//*from w ww .j a v a2 s .c o m*/ public void testIntegerSet() throws JSONException { final JSONObject object1 = new JSONObject("{ 'test': null }"); Set<Integer> ints = JsonUtils.optIntegerSet(object1, "test"); assertNull(ints); final JSONObject object2 = new JSONObject("{ 'test': [2,3,5,23] }"); ints = JsonUtils.optIntegerSet(object2, "test"); assertNotNull(ints); assertEquals(new HashSet<Integer>(Arrays.asList(2, 3, 5, 23)), ints); assertEquals(new HashSet<Integer>(Arrays.asList(123)), JsonUtils.optIntegerSet(new JSONObject("{ 'test': [123] }"), "test")); assertEquals(new HashSet<Integer>(Arrays.asList(0)), JsonUtils.optIntegerSet(new JSONObject("{ 'test': [0] }"), "test")); assertEquals(new HashSet<Integer>(Arrays.asList(1)), JsonUtils.optIntegerSet(new JSONObject("{ 'test': [1,1,1] }"), "test")); assertEquals(Collections.emptySet(), JsonUtils.optIntegerSet(new JSONObject("{ 'test': [] }"), "test")); }
From source file:com.github.rvesse.airline.utils.AirlineUtils.java
public static <T> Set<T> unmodifiableSetCopy(Iterable<T> iterable) { if (iterable == null) return Collections.emptySet(); LinkedHashSet<T> set = new LinkedHashSet<T>(); Iterator<T> iter = iterable.iterator(); while (iter.hasNext()) { set.add(iter.next());//w w w . j ava2 s . c om } return Collections.unmodifiableSet(set); }
From source file:com.haulmont.timesheets.global.DateTimeUtils.java
private static Set<String> holidayAsSeparateStrings(Holiday holiday, Date startDate, Date endDate, String format) {/*from w w w .j a va 2 s .co m*/ Date start; Date end; if (holiday.getStartDate().getTime() >= startDate.getTime()) { start = holiday.getStartDate(); } else { start = startDate; } if (holiday.getEndDate().getTime() <= endDate.getTime()) { end = holiday.getEndDate(); } else { end = endDate; } if (start.equals(startDate) && end.equals(endDate)) { return Collections.emptySet(); } else { Set<String> stringDates = new HashSet<>(); DateFormat formatter = new SimpleDateFormat(format); while (start.getTime() <= end.getTime()) { stringDates.add(formatter.format(start)); start = DateUtils.addDays(start, 1); } return stringDates; } }
From source file:io.knotx.knot.AbstractKnotProxy.java
private boolean shouldProcess(KnotContext context) { Set<String> knots = Optional.ofNullable(context.getFragments()).map(this::getKnotSet) .orElse(Collections.emptySet()); return shouldProcess(knots); }
From source file:com.ikanow.aleph2.analytics.spark.services.SparkPyWrapperService.java
/** Get a list of available RDDs * @return//from ww w . jav a 2 s . co m */ public Set<String> getRddInputNames() { initializeRdd(Collections.emptySet()); return _rdd_set.get().keySet(); }