Java Code Examples for java.util.Collections#emptyList()

The following examples show how to use java.util.Collections#emptyList() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: openvsx   File: VSCodeAdapter.java    License: Eclipse Public License 2.0 6 votes vote down vote up
private ExtensionQueryResult findExtension(long id, int flags) {
    var extension = entityManager.find(Extension.class, id);
    var resultItem = new ExtensionQueryResult.ResultItem();
    if (extension == null)
        resultItem.extensions = Collections.emptyList();
    else
        resultItem.extensions = Lists.newArrayList(toQueryExtension(extension, flags));

    var countMetadataItem = new ExtensionQueryResult.ResultMetadataItem();
    countMetadataItem.name = "TotalCount";
    countMetadataItem.count = extension == null ? 0 : 1;
    var countMetadata = new ExtensionQueryResult.ResultMetadata();
    countMetadata.metadataType = "ResultCount";
    countMetadata.metadataItems = Lists.newArrayList(countMetadataItem);
    resultItem.resultMetadata = Lists.newArrayList(countMetadata);

    var result = new ExtensionQueryResult();
    result.results = Lists.newArrayList(resultItem);
    return result;
}
 
Example 2
@Override
public List<RemotableAttributeError> validateAttributesAgainstExisting(String kimTypeId, Map<String, String> newAttributes, Map<String, String> oldAttributes){
       if (StringUtils.isBlank(kimTypeId)) {
           throw new RiceIllegalArgumentException("kimTypeId was null or blank");
       }

       if (newAttributes == null) {
           throw new RiceIllegalArgumentException("newAttributes was null or blank");
       }

       if (oldAttributes == null) {
           throw new RiceIllegalArgumentException("oldAttributes was null or blank");
       }
       return Collections.emptyList();
       //final List<RemotableAttributeError> errors = new ArrayList<RemotableAttributeError>();
       //errors.addAll(validateUniqueAttributes(kimTypeId, newAttributes, oldAttributes));
       //return Collections.unmodifiableList(errors);

}
 
Example 3
public List<VOService> servicesForLandingpage(String marketplaceId,
        String locale) {
    List<VOService> services = null;
    try {
        services = landingpageService.servicesForPublicLandingpage(marketplaceId,
                locale);
    } catch (ObjectNotFoundException onf) {
        services = Collections.emptyList();
    }
    return services;
}
 
Example 4
Source Project: spring-boot   File: StoredProcedure2.java    License: MIT License 5 votes vote down vote up
List<Book> findBookByName(String name) {

        SqlParameterSource paramaters = new MapSqlParameterSource()
                .addValue("p_name", name);

        Map out = simpleJdbcCallRefCursor.execute(paramaters);

        if (out == null) {
            return Collections.emptyList();
        } else {
            return (List) out.get("o_c_book");
        }

    }
 
Example 5
public RemoteCall<TransactionReceipt> newEvidence(String evi, String info, String id, BigInteger v, byte[] r, byte[] s) {
    final Function function = new Function(
            FUNC_NEWEVIDENCE, 
            Arrays.<Type>asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(evi), 
            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(info), 
            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(id), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint8(v), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(r), 
            new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32(s)), 
            Collections.<TypeReference<?>>emptyList());
    return executeRemoteCallTransaction(function);
}
 
Example 6
public List<RawDataFile> getMatchingRawDataFiles() {

    switch (selectionType) {

      case GUI_SELECTED_FILES:
        return MZmineGUI.getSelectedRawDataFiles();
      case ALL_FILES:
        return MZmineCore.getCurrentProject().getRawDataFiles();
      case SPECIFIC_FILES:
        if (specificFiles == null)
          return Collections.emptyList();
        else
          return specificFiles;
      case NAME_PATTERN:
        if (Strings.isNullOrEmpty(namePattern))
          return Collections.emptyList();
        ArrayList<RawDataFile> matchingDataFiles = new ArrayList<RawDataFile>();
        List<RawDataFile> allDataFiles = MZmineCore.getCurrentProject().getRawDataFiles();

        fileCheck: for (RawDataFile file : allDataFiles) {

          final String fileName = file.getName();

          final String regex = TextUtils.createRegexFromWildcards(namePattern);

          if (fileName.matches(regex)) {
            if (matchingDataFiles.contains(file))
              continue;
            matchingDataFiles.add(file);
            continue fileCheck;
          }
        }
        return matchingDataFiles;
      case BATCH_LAST_FILES:
        return Collections.emptyList();
    }

    throw new IllegalStateException("This code should be unreachable");

  }
 
Example 7
@Test
public void testFullOuterJoinWithEmptyRightInput() throws Exception {
	final List<String> leftInput = Arrays.asList("foo", "bar", "foobar");
	final List<String> rightInput = Collections.emptyList();
	baseOperator.setOuterJoinType(OuterJoinOperatorBase.OuterJoinType.FULL);
	List<String> expected = Arrays.asList("bar,null", "foo,null", "foobar,null");
	testOuterJoin(leftInput, rightInput, expected);
}
 
Example 8
Source Project: multiapps   File: ModelParser.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
protected <E> List<E> getListElement(String key, ListParser<E> builder) {
    Object list = source.get(key);
    if (list != null) {
        return builder.setSource(((List<Object>) list))
                      .parse();
    }
    return Collections.emptyList();
}
 
Example 9
Source Project: web3sdk   File: ParallelOk.java    License: Apache License 2.0 5 votes vote down vote up
public void transfer(String from, String to, BigInteger num, TransactionSucCallback callback) {
    final Function function =
            new Function(
                    FUNC_TRANSFER,
                    Arrays.<Type>asList(
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(from),
                            new org.fisco.bcos.web3j.abi.datatypes.Utf8String(to),
                            new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(num)),
                    Collections.<TypeReference<?>>emptyList());
    asyncExecuteTransaction(function, callback);
}
 
Example 10
Source Project: flink   File: PluginUtils.java    License: Apache License 2.0 5 votes vote down vote up
private static PluginManager createPluginManagerFromRootFolder(PluginConfig pluginConfig) {
	if (pluginConfig.getPluginsPath().isPresent()) {
		try {
			Collection<PluginDescriptor> pluginDescriptors =
				new DirectoryBasedPluginFinder(pluginConfig.getPluginsPath().get()).findPlugins();
			return new DefaultPluginManager(pluginDescriptors, pluginConfig.getAlwaysParentFirstPatterns());
		} catch (IOException e) {
			throw new FlinkRuntimeException("Exception when trying to initialize plugin system.", e);
		}
	}
	else {
		return new DefaultPluginManager(Collections.emptyList(), pluginConfig.getAlwaysParentFirstPatterns());
	}
}
 
Example 11
ScriptClassInfo getScriptClassInfo() {
    ScriptClassInfo sci = null;
    if (scriptClassName != null) {
        sci = new ScriptClassInfo();
        sci.setName(scriptClassName);
        if (scriptMembers == null) {
            scriptMembers = Collections.emptyList();
        }
        sci.setMembers(scriptMembers);
        sci.setJavaName(javaClassName);
    }
    return sci;
}
 
Example 12
/** @hide */
@Override
@SuppressWarnings("unchecked")
public @NonNull List<SharedLibraryInfo> getSharedLibrariesAsUser(int flags, int userId) {
    try {
        ParceledListSlice<SharedLibraryInfo> sharedLibs = mPM.getSharedLibraries(
                mContext.getOpPackageName(), flags, userId);
        if (sharedLibs == null) {
            return Collections.emptyList();
        }
        return sharedLibs.getList();
    } catch (RemoteException e) {
        throw e.rethrowFromSystemServer();
    }
}
 
Example 13
public List<Row> parseResponse() {
  if (baselineResponse == null || currentResponse == null) {
    return Collections.emptyList();
  }
  boolean hasGroupByDimensions = false;
  if (groupByDimensions != null && groupByDimensions.size() > 0) {
    hasGroupByDimensions = true;
  }
  boolean hasGroupByTime = false;
  if (aggTimeGranularity != null) {
    hasGroupByTime = true;
  }

  metricFunctions = baselineResponse.getMetricFunctions();
  numMetrics = metricFunctions.size();
  numTimeBuckets = Math.min(currentRanges.size(), baselineRanges.size());
  if (currentRanges.size() != baselineRanges.size()) {
    LOGGER.info("Current and baseline time series have different length, which could be induced by DST.");
  }
  rows = new ArrayList<>();

  if (hasGroupByTime) {
    if (hasGroupByDimensions) { // contributor view
      parseGroupByTimeDimensionResponse();
    } else { // tabular view
      parseGroupByTimeResponse();
    }
  } else {
    if (hasGroupByDimensions) { // heatmap
      parseGroupByDimensionResponse();
    } else {
      throw new UnsupportedOperationException("Response cannot have neither group by time nor group by dimension");
    }
  }
  return rows;
}
 
Example 14
protected List<KimAttributeField> getAttributeDefinitionsForRole(PersonDocumentRole role) {
   	KimTypeService kimTypeService = KimFrameworkServiceLocator.getKimTypeService(KimTypeBo.to(
               role.getKimRoleType()));
   	//it is possible that the the kimTypeService is coming from a remote application
       // and therefore it can't be guarenteed that it is up and working, so using a try/catch to catch this possibility.
       try {
       	if ( kimTypeService != null ) {
       		return kimTypeService.getAttributeDefinitions(role.getKimTypeId());
       	}
       } catch (Exception ex) {
           LOG.warn("Not able to retrieve KimTypeService from remote system for KIM Role Type: " + role.getKimRoleType(), ex);
       }
   	return Collections.emptyList();
}
 
Example 15
Source Project: hawkular-metrics   File: Metric.java    License: Apache License 2.0 4 votes vote down vote up
public Metric(MetricId<T> id, Integer dataRetention) {
    this(id, Collections.emptyMap(), dataRetention, Collections.emptyList());
}
 
Example 16
Source Project: elexis-3-core   File: Message.java    License: Eclipse Public License 1.0 4 votes vote down vote up
@Override
public List<String> getPreferredTransporters(){
	return Collections.emptyList();
}
 
Example 17
Source Project: datacollector-api   File: ErrorMessage.java    License: Apache License 2.0 4 votes vote down vote up
public ErrorMessage(String resourceBundle, ErrorCode errorCode, Object... params) {
  this(Collections.emptyList(), resourceBundle, errorCode, params);
}
 
Example 18
public Collection<ChildElementAssumption> getChildElementAssumptions() {
  return Collections.emptyList();
}
 
Example 19
Source Project: phoenix   File: ListJarsQueryPlan.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public List<List<Scan>> getScans() {
    return Collections.emptyList();
}
 
Example 20
@Override
public List<ConnectionRecord> getHistory() throws GuacamoleException {
    return Collections.<ConnectionRecord>emptyList();
}