Example usage for java.util Collections EMPTY_SET

List of usage examples for java.util Collections EMPTY_SET

Introduction

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

Prototype

Set EMPTY_SET

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

Click Source Link

Document

The empty set (immutable).

Usage

From source file:gov.nih.nci.caarray.util.CaArrayUtils.java

/**
 * Returns an empty collection or map of the appropriate type for a given collection class. By default, returns an
 * empty list, but will return an empty set, empty sorted set, or empty map if the passed in type is a subclass of
 * Set, SortedSet, or Map respectively.//from   w ww. ja v a2  s .  co  m
 * 
 * @param collectionType the class of whose type to return an empty collection or map
 * @return the empty collection or map
 */
public static Object emptyCollectionOrMapFor(Class<?> collectionType) {
    Object val = Collections.EMPTY_LIST;
    if (SortedSet.class.isAssignableFrom(collectionType)) {
        val = EMPTY_SORTED_SET;
    } else if (Set.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_SET;
    } else if (List.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_LIST;
    } else if (Map.class.isAssignableFrom(collectionType)) {
        val = Collections.EMPTY_MAP;
    }
    return val;
}

From source file:org.stockwatcher.web.WatchListController.java

@RequestMapping(method = RequestMethod.GET)
public String watchListsForUser(Model model, HttpServletRequest request) {
    User user = (User) request.getSession().getAttribute("user");
    model.addAttribute("watchLists",
            user == null ? Collections.EMPTY_SET : watchListDAO.getWatchListsByUserId(user.getId()));
    return "watchLists";
}

From source file:org.apache.cayenne.gen.DataMapUtils.java

/**
 * Get all parameter names that used in query qualifier.
 *
 * @param query select query descriptor//from  w  w  w.j  a v a 2 s .com
 * @return Parameter names.
 */
public Collection getParameterNames(SelectQueryDescriptor query) {

    if (query.getQualifier() == null) {
        return Collections.EMPTY_SET;
    }

    Map<String, String> queryParameters = queriesMap.get(query.getName());

    if (queryParameters == null) {
        queryParameters = getParameterNames(query.getQualifier(), query.getRoot());
        queriesMap.put(query.getName(), queryParameters);
    }

    return parseQualifier(query.getQualifier().toString());
}

From source file:org.polymap.kaps.ui.BooleanFormField.java

public Control createControl(Composite parent, IFormEditorToolkit toolkit) {
    int comboStyle = SWT.DROP_DOWN | SWT.READ_ONLY;
    combo = toolkit.createCombo(parent, Collections.EMPTY_SET, comboStyle | SWT.MULTI);

    for (ModifyListener l : modifyListeners) {
        combo.addModifyListener(l);/*  w  w w.  j  a va2  s.  c  o  m*/
    }

    // add values
    fillCombo();
    // selection listener
    combo.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent ev) {
            log.debug("widgetSelected(): selectionIndex= " + combo.getSelectionIndex());

            int i = 0;

            // for (String label : values.keySet()) {
            // if (i++ == combo.getSelectionIndex()) {
            // combo.setText( label );
            // break;
            // }
            // }
            Object value = values.get(combo.getText());
            site.fireEvent(BooleanFormField.this, IFormFieldListener.VALUE_CHANGE, value);
        }

        public void widgetDefaultSelected(SelectionEvent ev) {
        }
    });

    // focus listener
    combo.addFocusListener(new FocusListener() {

        public void focusLost(FocusEvent event) {
            combo.setBackground(FormEditorToolkit.textBackground);
            site.fireEvent(this, IFormFieldListener.FOCUS_LOST, combo.getText());
        }

        public void focusGained(FocusEvent event) {
            combo.setBackground(FormEditorToolkit.textBackgroundFocused);
            site.fireEvent(this, IFormFieldListener.FOCUS_GAINED, combo.getText());
        }
    });

    return combo;
}

From source file:com.globalsight.ling.tm3.tools.CreateBilingualTmCommand.java

@Override
public TM3Tm<?> createTm(CommandLine command) throws Exception {
    TM3Locale srcLocale = getDataFactory().getLocaleByCode(command.getOptionValue(SOURCE));
    if (srcLocale == null) {
        die("'" + command.getOptionValue(SOURCE) + "' is not a valid locale code for -" + SOURCE);
    }/*from w  ww  . j  av  a2 s  .  c  o m*/
    TM3Locale tgtLocale = getDataFactory().getLocaleByCode(command.getOptionValue(TARGET));
    if (tgtLocale == null) {
        die("'" + command.getOptionValue(TARGET) + "' is not a valid locale code for -" + TARGET);
    }

    return getManager().createBilingualTm(null, Collections.EMPTY_SET, srcLocale, tgtLocale);
}

From source file:com.acc.cockpits.productcockpit.editor.ExternalTaxesSectionConfiguration.java

@Override
public Set<ObjectType> getUpdateTriggerTypes() {
    return Collections.EMPTY_SET;
}

From source file:com.phoenixst.plexus.DefaultRootedTreeView.java

public Collection rootNodes() {
    if (!getGraph().containsNode(root)) {
        return Collections.EMPTY_SET;
    }/* w w w.ja  va 2  s  . co m*/
    return Collections.singleton(root);
}

From source file:org.jboss.dashboard.ui.utils.javascriptUtils.JavascriptTree.java

public Set getChildren() {
    return children == null ? Collections.EMPTY_SET : Collections.unmodifiableSortedSet(children);
}

From source file:org.wings.DynamicCodeResource.java

/** 
 * The HTTP header parameteres attached to this dynamic code ressource.
 * This <b>static</b> list will by default contain entries to disable caching 
 * on the server side. Call <code>getHeaders().clear()</code> to avoid this
 * i.e. if you want to enable back buttons. 
 * @return A <code>Collection</code> of {@link HeaderEntry} objects.
 *//*from   w  w  w. j  ava2 s.co  m*/
public Collection getHeaders() {
    if (getFrame().isNoCaching())
        return DEFAULT_CODE_HEADER;
    else
        return Collections.EMPTY_SET;
}

From source file:com.ctb.service.task.AuthorizationService.java

/**
 * ???//  ww w . ja  va  2s  .co m
 * 
 * @param username
 * @return
 */
@SuppressWarnings("unchecked")
public Set<String> findRoles(String appKey, String username) {
    User user = accountService.findUserByLoginName(username);
    if (user == null) {
        return Collections.EMPTY_SET;
    }
    Long appId = appService.findAppIdByAppKey(appKey);
    if (appId == null) {
        return Collections.EMPTY_SET;
    }
    Authorization authorization = authorizationDao.findByAppIdAndUserId(appId, user.getId());
    if (authorization == null) {
        return Collections.EMPTY_SET;
    }
    return roleService.findRoles(authorization.getRoleIds().toArray(new Long[0]));
}