List of usage examples for java.util Collections emptyList
@SuppressWarnings("unchecked") public static final <T> List<T> emptyList()
From source file:org.trustedanalytics.datasetpublisher.service.HiveServiceTest.java
@Test public void testCreateTable() throws Exception { // given/*from w ww . ja v a 2 s . c o m*/ final HiveTable hiveTable = new HiveTable("db", "table", Collections.emptyList(), "loc"); Connection connection = mock(Connection.class); Statement stm = mock(Statement.class); // when when(connection.createStatement()).thenReturn(stm); when(hiveClient.getConnection(userIdentity)).thenReturn(connection); hiveService.createTable(hiveTable, userIdentity); // then verify(queryBuilder).createTable(hiveTable); }
From source file:com.cloudera.oryx.kmeans.computation.local.Assignment.java
@Override public List<String> call() { Config config = ConfigUtils.getDefaultConfig(); List<String> ret = new ArrayList<>(); if (doOutlierComputation(config)) { InboundSettings inboundSettings = InboundSettings.create(config); if (inboundSettings.getIdColumns().isEmpty()) { log.error("Cluster assignments require that id-columns be configured for each vector"); return Collections.emptyList(); }//from w w w .ja v a 2 s.c om for (List<RealVector> fold : folds) { for (RealVector vec : fold) { NamedRealVector nvec = (NamedRealVector) vec; for (KMeansEvaluationData data : clusters) { Distance d = data.getBest().getDistance(nvec); ret.add(COMMA.join(nvec.getName(), data.getK(), d.getClosestCenterId(), d.getSquaredDistance())); } } } return ret; } return Collections.emptyList(); }
From source file:com.github.ukase.toolkit.jar.JarSource.java
@Autowired public JarSource(CompoundTemplateLoader templateLoader, UkaseSettings settings) { this.templateLoader = templateLoader; if (settings.getJar() == null) { classLoader = null;/*from w w w . j av a 2 s . c om*/ fonts = Collections.emptyList(); return; } try { URL jar = settings.getJar().toURI().toURL(); Collection<String> props = templateLoader.getResources(IS_HELPERS_CONFIGURATION); Properties properties = new Properties(); props.stream().map(templateLoader::getResource).filter(entry -> entry != null).map(this::mapZipEntry) .filter(stream -> stream != null).forEach(stream -> loadStreamToProperties(stream, properties)); properties.forEach(this::registerHelper); fonts = templateLoader.getResources(IS_FONT).parallelStream().map(font -> "jar:" + jar + "!/" + font) .collect(Collectors.toList()); if (hasHelpers()) { URL[] jars = new URL[] { jar }; classLoader = new URLClassLoader(jars, getClass().getClassLoader()); helpers.forEach((name, className) -> helpersInstances.put(name, getHelper(className))); } else { classLoader = null; } } catch (IOException e) { throw new IllegalStateException("Wrong configuration", e); } }
From source file:cz.muni.fi.mir.db.dao.impl.UserDAOImpl.java
@Override public List<User> getUsersByRole(UserRole userRole) { List<User> resultList = Collections.emptyList(); try {//from www . ja v a 2 s . com resultList = entityManager .createQuery("SELECT u FROM users u WHERE :userRoleId MEMBER OF u.userRoles", User.class) .setParameter("userRoleId", userRole.getId()).getResultList(); } catch (NoResultException nre) { logger.debug(nre); } return resultList; }
From source file:com.netflix.spinnaker.kork.artifacts.parsing.JinjaArtifactExtractor.java
public List<Artifact> getArtifacts(String messagePayload) { if (StringUtils.isEmpty(messagePayload)) { return Collections.emptyList(); }// w w w. j av a2s .c o m return readArtifactList(jinjaTransform(messagePayload)); }
From source file:ch.ivyteam.ivy.maven.engine.EngineClassLoaderFactory.java
public static List<File> getOsgiBootstrapClasspath(File engineDirectory) { if (engineDirectory == null || !engineDirectory.isDirectory()) { return Collections.emptyList(); }/* w ww . j a va 2 s . c o m*/ List<File> classPathFiles = new ArrayList<>(); addToClassPath(classPathFiles, new File(engineDirectory, "lib/boot"), new SuffixFileFilter(".jar")); return classPathFiles; }
From source file:com.couchbase.workshop.QueryController.java
@RequestMapping("/prepared") public List<String> prepared() { // IMPLEMENT ME return Collections.emptyList(); }
From source file:com.prowidesoftware.swift.model.SwiftMessageUtils.java
/** * Mirrors logic on {@link CurrencyContainer#currencyStrings()} including all fields * @param m/*from ww w . j a v a 2 s . c o m*/ * @return an empty list if none found */ public static List<String> currencyStrings(final SwiftMessage m) { if (m != null) { final SwiftBlock4 b4 = m.getBlock4(); if (b4 != null && !b4.isEmpty()) { final ArrayList<String> curs = new ArrayList<String>(); for (final Tag t : b4.getTags()) { final Field f = t.getField(); if (f instanceof CurrencyContainer) { final CurrencyContainer cc = (CurrencyContainer) f; curs.addAll(cc.currencyStrings()); } } return curs; } } return Collections.emptyList(); }
From source file:com.haulmont.yarg.loaders.impl.SqlDataLoader.java
@Override public List<Map<String, Object>> loadData(ReportQuery reportQuery, BandData parentBand, Map<String, Object> params) { List resList;// www . java 2 s .co m final List<OutputValue> outputValues = new ArrayList<OutputValue>(); String query = reportQuery.getScript(); if (StringUtils.isBlank(query)) { return Collections.emptyList(); } try { if (Boolean.TRUE.equals(reportQuery.getProcessTemplate())) { query = processQueryTemplate(query, parentBand, params); } final QueryPack pack = prepareQuery(query, parentBand, params); ArrayList<Object> resultingParams = new ArrayList<Object>(); QueryParameter[] queryParameters = pack.getParams(); for (QueryParameter queryParameter : queryParameters) { if (queryParameter.isSingleValue()) { resultingParams.add(queryParameter.getValue()); } else { resultingParams.addAll(queryParameter.getMultipleValues()); } } resList = runQuery(reportQuery, pack.getQuery(), resultingParams.toArray(), new ResultSetHandler<List>() { @Override public List handle(ResultSet rs) throws SQLException { List<Object[]> resList = new ArrayList<Object[]>(); while (rs.next()) { ResultSetMetaData metaData = rs.getMetaData(); if (outputValues.size() == 0) { for (int columnIndex = 1; columnIndex <= metaData .getColumnCount(); columnIndex++) { String columnName = metaData.getColumnLabel(columnIndex); OutputValue outputValue = new OutputValue(columnName); setCaseSensitiveSynonym(columnName, outputValue); outputValues.add(outputValue); } } Object[] values = new Object[metaData.getColumnCount()]; for (int columnIndex = 0; columnIndex < metaData.getColumnCount(); columnIndex++) { values[columnIndex] = convertOutputValue(rs.getObject(columnIndex + 1)); } resList.add(values); } return resList; } private void setCaseSensitiveSynonym(String columnName, OutputValue outputValue) { Matcher matcher = Pattern.compile("(?i)as\\s*(" + columnName + ")") .matcher(pack.getQuery()); if (matcher.find()) { outputValue.setSynonym(matcher.group(1)); } } }); } catch (DataLoadingException e) { throw e; } catch (Throwable e) { throw new DataLoadingException( String.format("An error occurred while loading data for data set [%s]", reportQuery.getName()), e); } return fillOutputData(resList, outputValues); }
From source file:info.novatec.testit.livingdoc.repository.FileSystemRepository.java
@Override public List<String> listDocuments(String location) throws IOException { File parent = fileAt(location); if (!parent.exists()) { return Collections.emptyList(); }// w w w. j ava2 s . c om List<String> names = new ArrayList<String>(); if (parent.isDirectory()) { for (File child : parent.listFiles(NOT_HIDDEN)) { if (child.isDirectory()) { names.addAll(listDocuments(relativePath(child))); } else if (!checkFileType(child).equals(FileTypes.NOTSUPPORTED)) { names.add(relativePath(child)); } } } return names; }