Example usage for java.util Collections EMPTY_LIST

List of usage examples for java.util Collections EMPTY_LIST

Introduction

In this page you can find the example usage for java.util Collections EMPTY_LIST.

Prototype

List EMPTY_LIST

To view the source code for java.util Collections EMPTY_LIST.

Click Source Link

Document

The empty list (immutable).

Usage

From source file:eu.ggnet.dwoss.redtape.position.PositionUpdateCask.java

/**
 * Creates new form PositionUpdateCask./* w w  w .  j  av a 2s. c  o m*/
 */
public PositionUpdateCask() {
    initComponents();
    ((JSpinner.DefaultEditor) postDecimalSpinner.getEditor()).getTextField().setEditable(false);
    //        ((JSpinner.DefaultEditor)preDecimalSpinner.getEditor()).getTextField().setEditable(false);
    PostLedger postLedger = lookup(MandatorSupporter.class).loadPostLedger();
    List bookingAccounts = new ArrayList();
    bookingAccounts.add(postLedger.get(SERVICE).orElse(-1));
    bookingAccounts.addAll(postLedger.getPossible(SERVICE).orElse(Collections.EMPTY_LIST));
    bookingAccountBox.setModel(new DefaultComboBoxModel(bookingAccounts.toArray()));

}

From source file:edu.harvard.med.screensaver.io.screenresults.ScreenResultParserTest.java

/**
 * This is the primary test of the ScreenResultParser.
 *///  w  w  w. j av a2s .c  o m
public void testParseScreenResult() throws Exception {
    ScreenResult screenResult = mockScreenResultParser.parse(MakeDummyEntities.makeDummyScreen(115),
            SCREEN_RESULT_115_TEST_WORKBOOK_FILE.getFile());
    assertEquals(Collections.EMPTY_LIST, mockScreenResultParser.getErrors());
    doTestScreenResult115ParseResult(screenResult);
}

From source file:de.innovationgate.webgate.api.WGDocumentListCache.java

/**
 * Rebuilds the document list from cache
 * The method will return null if the number of documents in the list that must be gathered 
 * from backend exceeds the database configuration on {@link WGDatabase#getListCacheRebuildThreshold()}
 * @param db The database that the documents belong to
 * @param offset The offset from which to return entries, 0 being the first one
 * @param size The number of entries to return at maximum
 * @return The rebuilt document list or null
 *//*from ww  w .  j  ava2  s.c om*/
public List buildDocumentSubList(WGDatabase db, int offset, int size) {

    if (offset >= _keys.size()) {
        if (isComplete()) {
            return Collections.EMPTY_LIST;
        } else {
            return null;
        }
    }

    int toIndex = offset + size;
    if (toIndex > _keys.size()) {

        // If the target index is not in the keys and we have not yet reached the end (meaning, the collection is only so long) we cannot use the cache
        if (!isReachedEnd()) {
            return null;
        } else {
            toIndex = _keys.size();
        }
    }

    return blowUpCache(db, _keys.subList(offset, toIndex));
}

From source file:org.apache.abdera2.common.protocol.ClientResponseImpl.java

@SuppressWarnings("unchecked")
public Iterable<Object> getHeaders(String name) {
    Header[] headers = response.getHeaders(name);
    if (headers == null)
        return Collections.EMPTY_LIST;
    List<Object> ret = new ArrayList<Object>();
    for (int n = 0; n < headers.length; n++)
        ret.add(headers[n].getValue());/*from   ww  w. ja  va 2s  . c om*/
    return ret;
}

From source file:flex2.compiler.mxml.gen.DescriptorGenerator.java

/**
 *
 *//*  w  ww .ja  v  a  2  s .c om*/
private static void addDescriptorProperties(CodeFragmentList list, Model model,
        final Set<String> includePropNames, boolean includeDesignLayer, String indent) {
    //  ordinary properties
    Iterator propIter = includePropNames == null ? model.getPropertyInitializerIterator(false)
            : new FilterIterator(model.getPropertyInitializerIterator(false), new Predicate() {
                public boolean evaluate(Object obj) {
                    return includePropNames.contains(((NamedInitializer) obj).getName());
                }
            });

    //  visual children
    Iterator vcIter = (model instanceof MovieClip && ((MovieClip) model).hasChildren())
            ? ((MovieClip) model).children().iterator()
            : Collections.EMPTY_LIST.iterator();

    // designLayer ?
    Boolean hasDesignLayer = (includeDesignLayer && (model.layerParent != null)
            && model.getType().isAssignableTo(model.getStandardDefs().INTERFACE_IVISUALELEMENT));

    if (propIter.hasNext() || vcIter.hasNext() || hasDesignLayer) {
        if (!list.isEmpty()) {
            list.add(indent, ",", 0);
        }

        list.add(indent, "propertiesFactory: function():Object { return {", 0);
        indent += DescriptorGenerator.INDENT;

        while (propIter.hasNext()) {
            NamedInitializer init = (NamedInitializer) propIter.next();
            if (!init.isStateSpecific()) {
                list.add(indent, init.getName(), ": ", init.getValueExpr(),
                        (propIter.hasNext() || vcIter.hasNext() || hasDesignLayer ? "," : ""),
                        init.getLineRef());
            }
        }

        if (hasDesignLayer) {
            list.add(indent, "designLayer", ": ", model.layerParent.getId(), (vcIter.hasNext() ? "," : ""),
                    model.getXmlLineNumber());
        }

        if (vcIter.hasNext()) {
            list.add(indent, "childDescriptors: [", 0);

            // Generate each child descriptor unless the child as explicitly filtered out.
            boolean isFirst = true;
            while (vcIter.hasNext()) {
                VisualChildInitializer init = (VisualChildInitializer) vcIter.next();
                Model child = (MovieClip) init.getValue();
                if (child.isDescriptorInit()) {
                    if (!isFirst) {
                        list.add(indent, ",", 0);
                    }

                    addDescriptorInitializerFragments(list, child, indent + DescriptorGenerator.INDENT);
                    isFirst = false;
                }

            }

            list.add(indent, "]", 0);
        }

        indent = indent.substring(0, indent.length() - INDENT.length());
        list.add(indent, "}}", 0);
    }
}

From source file:org.opencredo.couchdb.core.CouchDbChangesTemplate.java

@SuppressWarnings("unchecked")
public List<ChangedDocument> pollForChanges() throws CouchDbOperationException {
    if (logger.isDebugEnabled()) {
        logger.debug("polling " + databaseUrl + " for changes from sequence " + currentSequence);
    }//from  w w w.  j av a  2 s.  c  om
    Changes changes = null;
    try {
        changes = restOperations.getForObject(databaseChangesUrl, Changes.class, currentSequence);
    } catch (RestClientException e) {
        throw new CouchDbOperationException("Unable to communicate with CouchDB", e);
    }

    if (logger.isDebugEnabled()) {
        logger.debug("found " + changes.getResults().size() + " changes");
    }

    Long lastSequence = changes.getLast_seq();
    if (lastSequence > currentSequence) {
        List<ChangedDocument> changedDocuments = prepareChanges(changes);
        currentSequence = lastSequence;
        return changedDocuments;
    } else {
        return Collections.EMPTY_LIST;
    }
}

From source file:com.pscnlab.train.services.impls.TrainServiceImpl.java

@Override
public ResultsTotalDTO<TrainPageDTO> findPageByTime(String time, Integer offset, Integer size,
        Integer memberUUId) {/*from w ww. j a v a2 s. c o  m*/
    Page<Train> trainPage = trainDao.findPageByTime(time, offset, size);
    List<Train> results = trainPage.getResults();
    if (CollectionUtils.isEmpty(results)) {
        return ResultsTotalDTO.build(Collections.EMPTY_LIST, trainPage.getTotalCount());
    }

    Set<Integer> trainIds = results.stream().map(Train::getUuidTrain).collect(Collectors.toSet());
    Map<Integer, List<TrainPeople>> trainPeopleMap = trainPeopleService
            .findMapByTrainIds(new ArrayList<>(trainIds));
    Map<Integer, MemberPageDTO> memberPageDTOMap = new HashMap<>();
    if (trainPeopleMap.size() > 0) {
        Set<Integer> memberIds = trainPeopleMap.values().stream().flatMap(List::stream)
                .map(TrainPeople::getUuidMember).collect(Collectors.toSet());
        memberPageDTOMap = memberSevice.findMemberWithRoleByIds(memberIds);
    }

    //?
    List<TrainPageDTO> trainPageDTOS = new ArrayList<>();
    for (Train result : results) {
        TrainPageDTO trainPageDTO = new TrainPageDTO();
        trainPageDTO.setTrain(result);
        //????
        Boolean isInTrainMember = Boolean.FALSE;
        List<Member> members = new ArrayList<>();
        List<TrainPeople> trainPeoples = trainPeopleMap.get(result.getUuidTrain());
        if (CollectionUtils.isNotEmpty(trainPeoples)) {
            for (TrainPeople trainPeople : trainPeoples) {
                MemberPageDTO memberPageDTO = memberPageDTOMap.get(trainPeople.getUuidMember());
                if (memberPageDTO != null) {
                    members.add(memberPageDTO.getMember());
                    if (memberPageDTO.getMember().getUuidMember().equals(memberUUId)) {
                        isInTrainMember = Boolean.TRUE;
                    }
                }
            }
        }
        trainPageDTO.setIsInTrainMember(isInTrainMember);
        trainPageDTO.setMembers(members);
        trainPageDTOS.add(trainPageDTO);
    }

    return ResultsTotalDTO.build(trainPageDTOS, trainPage.getTotalCount());
}

From source file:it.unibas.spicy.model.mapping.rewriting.sourcenulls.FindNullablePathsInSource.java

@SuppressWarnings("unchecked")
private PathClassification classifyPathsInChainingSource(IDataSourceProxy sourceProxy) {
    ChainingDataSourceProxy chainingProxy = (ChainingDataSourceProxy) sourceProxy;
    MappingTask mappingTask = chainingProxy.getMappingTask();
    IDataSourceProxy previousSourceProxy = mappingTask.getSourceProxy();
    List<PathExpression> nullablePaths = new ArrayList<PathExpression>();
    List<PathExpression> notNullablePaths = new ArrayList<PathExpression>();
    List<PathExpression> alwaysNullPaths = new ArrayList<PathExpression>();
    List<PathExpression> allAttributes = findAllAttributes(sourceProxy);
    for (PathExpression pathExpression : allAttributes) {
        List<VariableCorrespondence> correspondencesForPath = findCorrespondencesForPath(pathExpression,
                mappingTask);//from w ww . j av  a2s .c  o  m
        if (correspondencesForPath.isEmpty()) {
            alwaysNullPaths.add(pathExpression);
        } else {
            if (allSourcePathsAreNotNull(correspondencesForPath, previousSourceProxy)) {
                notNullablePaths.add(pathExpression);
            } else {
                nullablePaths.add(pathExpression);
            }
        }

    }
    return new PathClassification(sourceProxy, nullablePaths, notNullablePaths, Collections.EMPTY_LIST);
}

From source file:jp.go.nict.langrid.serviceexecutor.google.GoogleTranslation.java

@SuppressWarnings("unchecked")
private LanguagePair validateLanguagePair(LanguagePairValidator languagePair) throws InvalidParameterException,
        LanguagePairNotUniquelyDecidedException, UnsupportedLanguagePairException {
    LanguagePair pair = languagePair.notNull().trim().notEmpty().getLanguagePair();
    String key = pair.toCodeString(":");
    try {//from www.ja  v a 2  s . c o  m
        boolean supported = (Boolean) langPairCache.getFromCache(key, 60 * 60 * 24);
        if (supported) {
            return pair;
        } else {
            languagePair.getUniqueLanguagePair(Collections.EMPTY_LIST);
        }
    } catch (NeedsRefreshException e) {
        languagePairValidator.set(languagePair);
        langPairCache.cancelUpdate(key);
    }
    return pair;
}