Example usage for java.util Collections emptySet

List of usage examples for java.util Collections emptySet

Introduction

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

Prototype

@SuppressWarnings("unchecked")
public static final <T> Set<T> emptySet() 

Source Link

Document

Returns an empty set (immutable).

Usage

From source file:edu.uci.ics.jung.graph.OrderedKAryTree.java

/**
 * Returns an ordered list of {@code vertex}'s child vertices.
 * If there is no child in position i, then the list will contain
 * {@code null} in position i.  If {@code vertex} has no children
 * then the empty set will be returned./*  ww w .j av  a 2 s.com*/
 * @see edu.uci.ics.jung.graph.Tree#getChildren(java.lang.Object)
 */
public Collection<V> getChildren(V vertex) {
    if (!containsVertex(vertex))
        return null;
    List<E> edges = vertex_data.get(vertex).child_edges;
    if (edges == null)
        return Collections.emptySet();
    Collection<V> children = new ArrayList<V>(order);
    for (E edge : edges)
        children.add(this.getOpposite(vertex, edge));
    return CollectionUtils.unmodifiableCollection(children);
}

From source file:io.cloudslang.lang.systemtests.BindingScopeTest.java

@Test
public void testInputWithDefaultValue() throws Exception {
    URL resource = getClass().getResource("/yaml/check_weather_required_input_with_default.sl");
    CompilationArtifact compilationArtifact = slang.compile(SlangSource.fromFile(resource.toURI()),
            new HashSet<SlangSource>());

    Map<String, Value> userInputs = new HashMap<>();
    userInputs.put("city", ValueFactory.create(""));
    userInputs.put("input_with_default_value", ValueFactory.create(""));
    Set<SystemProperty> systemProperties = Collections.emptySet();

    Map<String, StepData> steps = triggerWithData(compilationArtifact, userInputs, systemProperties).getSteps();

    assertEquals("default_value", steps.get(EXEC_START_PATH).getInputs().get("input_with_default_value"));
    assertEquals("", steps.get(EXEC_START_PATH).getInputs().get("city"));
}

From source file:com.pc.dailymile.domain.Entry.java

public Set<Like> getLikes() {
    if (likes == null) {
        return Collections.emptySet();
    }//from  w  w w.  jav a2s.c o  m
    return new TreeSet<Like>(likes);
}

From source file:org.n52.iceland.service.operator.ServiceOperatorRepository.java

/**
 * @param service/*from   w w  w  . jav  a 2s  .com*/
 *            the service
 * @return the supportedVersions
 *
 */
public Set<String> getSupportedVersions(String service) {
    return Collections.unmodifiableSet(this.supportedVersions.getOrDefault(service, Collections.emptySet()));
}

From source file:org.shredzone.cilla.service.search.impl.SearchResultImpl.java

@Override
public Set<Integer> fetchPageDays(Calendar calendar) throws CillaServiceException {
    if (calendar == null) {
        return Collections.emptySet();
    }/*from  w  w  w  . j a  v  a 2s .c  om*/

    return getSearchStrategy().fetchPageDays(this, calendar);
}

From source file:com.perl5.lang.perl.parser.Exception.Class.psi.impl.PerlExceptionClassWrapper.java

private void processExceptionElement(@NotNull List<PsiElement> listElements, int currentIndex,
        @NotNull List<PerlDelegatingLightNamedElement> result) {
    PsiElement listElement = listElements.get(currentIndex);
    if (!isAcceptableIdentifierElement(listElement)) {
        return;/* w  w  w . j  a v a2s .  c  om*/
    }
    String namespaceName = ElementManipulators.getValueText(listElement);
    if (StringUtil.isEmpty(namespaceName)) {
        return;
    }

    Map<String, PerlHashEntry> exceptionSettings = listElements.size() > currentIndex + 1
            ? PerlHashUtil.collectHashMap(listElements.get(currentIndex + 1))
            : Collections.emptyMap();

    // Building fields
    Set<PerlSubArgument> throwArguments = Collections.emptySet();
    PerlHashEntry fieldsEntry = exceptionSettings.get("fields");
    if (fieldsEntry != null && fieldsEntry.isComplete()) {
        PsiElement fieldsContainer = fieldsEntry.getNonNullValueElement();
        if (fieldsContainer instanceof PsiPerlAnonArray) {
            fieldsContainer = ((PsiPerlAnonArray) fieldsContainer).getExpr();
        }
        List<PsiElement> elements = PerlArrayUtil.collectListElements(fieldsContainer);
        if (!elements.isEmpty()) {

            // Fields method
            result.add(new PerlLightMethodDefinitionElement<>(this, FIELDS_METHOD_NAME, LIGHT_METHOD_DEFINITION,
                    fieldsEntry.keyElement, namespaceName, Collections.emptyList(), null));

            // fields themselves
            throwArguments = new LinkedHashSet<>();
            for (PsiElement fieldElement : elements) {
                if (isAcceptableIdentifierElement(fieldElement)) {
                    String fieldName = PerlScalarUtil.getStringContent(fieldElement);
                    if (StringUtil.isNotEmpty(fieldName)) {
                        throwArguments.add(PerlSubArgument.mandatoryScalar(fieldName));
                        result.add(
                                new PerlLightMethodDefinitionElement<>(this, fieldName, LIGHT_METHOD_DEFINITION,
                                        fieldElement, namespaceName, Collections.emptyList(), null));
                    }
                }
            }
        }
    }

    // making exception class
    PerlHashEntry isaEntry = exceptionSettings.get("isa");
    String parentClass = "Exception::Class::Base";
    if (isaEntry != null && isaEntry.isComplete()) {
        String manualIsa = isaEntry.getValueString();
        if (manualIsa != null) {
            parentClass = manualIsa;
        }
    }

    result.add(new PerlLightExceptionClassDefinition(this, namespaceName, LIGHT_NAMESPACE_DEFINITION,
            listElement, PerlMroType.DFS, Collections.singletonList(parentClass),
            PerlNamespaceAnnotations.tryToFindAnnotations(listElement, getParent()), Collections.emptyList(),
            Collections.emptyList(), Collections.emptyMap()));

    // making alias
    PerlHashEntry aliasEntry = exceptionSettings.get("alias");
    if (aliasEntry != null && aliasEntry.isComplete()) {
        if (isAcceptableIdentifierElement(aliasEntry.valueElement)) {
            String aliasName = aliasEntry.getValueString();
            if (StringUtils.isNotEmpty(aliasName)) {
                result.add(new PerlLightSubDefinitionElement<>(this, aliasName, LIGHT_SUB_DEFINITION,
                        aliasEntry.getNonNullValueElement(), PerlPackageUtil.getContextPackageName(this),
                        new ArrayList<>(throwArguments), PerlSubAnnotations
                                .tryToFindAnnotations(aliasEntry.keyElement, aliasEntry.valueElement)));
            }
        }
    }
}

From source file:ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition.java

@Override
public Set<String> getValidChildNames() {
    return Collections.emptySet();
}

From source file:hudson.matrix.MatrixTest.java

private static void expectRejection(MatrixProject project, String combinationFilter, String signature)
        throws IOException {
    ScriptApproval scriptApproval = ScriptApproval.get();
    assertEquals(Collections.emptySet(), scriptApproval.getPendingSignatures());
    try {//  www .  j  a  v  a 2s .  c  om
        project.setCombinationFilter(combinationFilter);
    } catch (RejectedAccessException x) {
        assertEquals(Functions.printThrowable(x), signature, x.getSignature());
    }
    Set<ScriptApproval.PendingSignature> pendingSignatures = scriptApproval.getPendingSignatures();
    assertEquals(1, pendingSignatures.size());
    assertEquals(signature, pendingSignatures.iterator().next().signature);
    scriptApproval.approveSignature(signature);
    assertEquals(Collections.emptySet(), scriptApproval.getPendingSignatures());
}

From source file:com.bigdata.dastor.dht.Range.java

/**
 * @param that/*from ww w .j a  va  2s  .c o  m*/
 * @return the intersection of the two Ranges.  this can be two disjoint Ranges if one is wrapping and one is not.
 * say you have nodes G and M, with query range (D,T]; the intersection is (M-T] and (D-G].
 * If there is no intersection, an empty list is returned.
 */
public Set<Range> intersectionWith(Range that) {
    if (that.contains(this))
        return rangeSet(this);
    if (this.contains(that))
        return rangeSet(that);

    boolean thiswraps = isWrapAround(left, right);
    boolean thatwraps = isWrapAround(that.left, that.right);
    if (!thiswraps && !thatwraps) {
        // neither wraps.  the straightforward case.
        if (!(left.compareTo(that.right) < 0 && that.left.compareTo(right) < 0))
            return Collections.emptySet();
        return rangeSet(new Range((Token) ObjectUtils.max(this.left, that.left),
                (Token) ObjectUtils.min(this.right, that.right)));
    }
    if (thiswraps && thatwraps) {
        // if the starts are the same, one contains the other, which we have already ruled out.
        assert !this.left.equals(that.left);
        // two wrapping ranges always intersect.
        // since we have already determined that neither this nor that contains the other, we have 2 cases,
        // and mirror images of those case.
        // (1) both of that's (1, 2] endpoints lie in this's (A, B] right segment:
        //  ---------B--------A--1----2------>
        // (2) only that's start endpoint lies in this's right segment:
        //  ---------B----1---A-------2------>
        // or, we have the same cases on the left segement, which we can handle by swapping this and that.
        return this.left.compareTo(that.left) < 0 ? intersectionBothWrapping(this, that)
                : intersectionBothWrapping(that, this);
    }
    if (thiswraps && !thatwraps)
        return intersectionOneWrapping(this, that);
    assert (!thiswraps && thatwraps);
    return intersectionOneWrapping(that, this);
}

From source file:org.osiam.auth.oauth_client.ClientEntity.java

@Override
@JsonIgnore
public Set<String> getResourceIds() {
    return Collections.emptySet();
}