Example usage for java.util LinkedHashMap values

List of usage examples for java.util LinkedHashMap values

Introduction

In this page you can find the example usage for java.util LinkedHashMap values.

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:org.sablo.IndexPageEnhancer.java

/**
 * Returns the contributions for webcomponents and services
 * @return headContributions//from w w w  .  j a va2s .c om
 */
static String getAllContributions(Collection<String> cssContributions, Collection<String> jsContributions,
        IContributionFilter contributionFilter) {
    ArrayList<String> allCSSContributions = new ArrayList<String>();
    ArrayList<String> allJSContributions = new ArrayList<String>();

    LinkedHashMap<String, JSONObject> allLibraries = new LinkedHashMap<>();
    Collection<WebComponentPackageSpecification<WebComponentSpecification>> webComponentPackagesDescriptions = new ArrayList<WebComponentPackageSpecification<WebComponentSpecification>>();
    webComponentPackagesDescriptions
            .addAll(WebComponentSpecProvider.getInstance().getWebComponentSpecifications().values());
    webComponentPackagesDescriptions
            .addAll(WebServiceSpecProvider.getInstance().getWebServiceSpecifications().values());

    for (WebComponentPackageSpecification<WebComponentSpecification> packageDesc : webComponentPackagesDescriptions) {
        if (packageDesc.getCssClientLibrary() != null) {
            mergeLibs(allLibraries, packageLibsToJSON(packageDesc.getCssClientLibrary(), "text/css"));
        }
        if (packageDesc.getJsClientLibrary() != null) {
            mergeLibs(allLibraries, packageLibsToJSON(packageDesc.getJsClientLibrary(), "text/javascript"));
        }

        for (WebComponentSpecification spec : packageDesc.getSpecifications().values()) {
            allJSContributions.add(spec.getDefinition());
            mergeLibs(allLibraries, spec.getLibraries());
        }
    }

    for (JSONObject lib : allLibraries.values()) {
        switch (lib.optString("mimetype")) {
        case "text/javascript":
            allJSContributions.add(lib.optString("url"));
            break;
        case "text/css":
            allCSSContributions.add(lib.optString("url"));
            break;
        default:
            log.warn("Unknown mimetype " + lib);
        }
    }

    if (cssContributions != null) {
        allCSSContributions.addAll(cssContributions);
    }

    if (jsContributions != null) {
        allJSContributions.addAll(jsContributions);
    }

    StringBuilder retval = new StringBuilder();
    List<String> filteredCSSContributions = contributionFilter != null
            ? contributionFilter.filterCSSContributions(allCSSContributions)
            : allCSSContributions;
    for (String lib : filteredCSSContributions) {
        retval.append(String.format("<link rel=\"stylesheet\" href=\"%s\"/>\n", lib));
    }
    List<String> filteredJSContributions = contributionFilter != null
            ? contributionFilter.filterJSContributions(allJSContributions)
            : allJSContributions;
    for (String lib : filteredJSContributions) {
        retval.append(String.format("<script src=\"%s\"></script>\n", lib));
    }

    // lists properties that need to be watched for client to server changes for each component/service type
    retval.append("<script src=\"spec/").append(ModifiablePropertiesGenerator.PUSH_TO_SERVER_BINDINGS_LIST)
            .append(".js\"></script>\n");

    return retval.toString();
}

From source file:com.grarak.kerneladiutor.activities.tools.profile.ProfileActivity.java

private void returnIntent(LinkedHashMap<String, String> commandsList) {
    ArrayList<String> ids = new ArrayList<>();
    ArrayList<String> commands = new ArrayList<>();
    Collections.addAll(ids, commandsList.keySet().toArray(new String[commands.size()]));
    Collections.addAll(commands, commandsList.values().toArray(new String[commands.size()]));
    if (commands.size() > 0) {
        Intent intent = new Intent();
        intent.putExtra(POSITION_INTENT, mProfilePosition);
        intent.putExtra(RESULT_ID_INTENT, ids);
        intent.putExtra(RESULT_COMMAND_INTENT, commands);
        setResult(0, intent);/*  w ww  .  j a va 2 s  .c  o  m*/
        finish();
    } else {
        Utils.toast(R.string.no_changes, ProfileActivity.this);
    }
}

From source file:com.att.aro.main.PacketPlots.java

/**
 * Creates the XYIntervalSeries for the uplink and downlink packets plot.
 * //from w  w  w.  j  ava2s  . c o m
 * @param plot
 *            The XYPlot for the uplink/downlink plots.
 * @param dataset
 *            The uplink/downlink datasets.
 */
private void populatePacketPlot(XYPlot plot, LinkedHashMap<Color, PacketSeries> dataset) {

    // Create the XY data set
    YIntervalSeriesCollection coll = new YIntervalSeriesCollection();
    XYItemRenderer renderer = plot.getRenderer();
    for (PacketSeries series : dataset.values()) {
        coll.addSeries(series);

        renderer.setSeriesPaint(coll.indexOf(series.getKey()), series.getColor());
    }

    // Create tooltip generator
    renderer.setBaseToolTipGenerator(new PacketToolTipGenerator());

    plot.setDataset(coll);
}

From source file:org.geosde.core.jdbc.JDBCDataStoreFactory.java

public final Param[] getParametersInfo() {
    LinkedHashMap map = new LinkedHashMap();
    setupParameters(map);//w  w w. j av a 2 s . c  o m

    return (Param[]) map.values().toArray(new Param[map.size()]);
}

From source file:ubic.gemma.web.controller.visualization.VisualizationValueObject.java

/**
 * Initialize the factor profiles.// w w w.  j ava2 s .co  m
 */
public void setUpFactorProfiles(
        LinkedHashMap<BioAssayValueObject, LinkedHashMap<ExperimentalFactor, Double>> layout) {
    if (layout == null) {
        VisualizationValueObject.log.warn("Null layout, ignoring");
        return;
    }

    Collection<ExperimentalFactor> efs = new HashSet<>();
    for (LinkedHashMap<ExperimentalFactor, Double> maps : layout.values()) {
        efs.addAll(maps.keySet());
    }

    this.factorProfiles = new ArrayList<>();
    for (ExperimentalFactor experimentalFactor : efs) {
        this.factorProfiles.add(new FactorProfile(experimentalFactor, layout));
    }
}

From source file:edu.jhuapl.openessence.web.util.MapQueryUtil.java

public int performUpdate(OeDataEntrySource mapLayerDataEntrySource, LinkedHashMap<String, Object> updateMap,
        Collection<String> placeholders) {
    JdbcTemplate pgdb = new JdbcTemplate(mapDataSource);
    StringBuilder sb = new StringBuilder();
    sb.append("insert into ").append(mapLayerDataEntrySource.getTableName());
    sb.append(" (");
    sb.append(StringUtils.join(updateMap.keySet(), ", "));
    sb.append(") values (");
    sb.append(StringUtils.join(placeholders, ", "));
    sb.append(")");
    String sql = sb.toString();// w ww.j ava2 s.c  om
    log.debug(sql);
    return pgdb.update(sql, updateMap.values().toArray());
}

From source file:org.netflux.core.RecordMetadata.java

/**
 * Removes from this metadata all the field metadata with names included in the supplied collection.
 * //from w  w w  . j a  v a 2  s  . c om
 * @param fieldNames the names of the field metadata to remove.
 * @throws NullPointerException if the specified collection is <code>null</code>.
 */
public void remove(Collection<String> fieldNames) {
    LinkedHashMap<String, Integer> fieldsToRemove = (LinkedHashMap<String, Integer>) this.fieldIndexes.clone();
    fieldsToRemove.keySet().retainAll(fieldNames);

    List<FieldMetadata> newFieldMetadata = (List<FieldMetadata>) this.fieldMetadata.clone();

    ListIterator<Integer> fieldIndexIterator = new ArrayList<Integer>(fieldsToRemove.values())
            .listIterator(fieldsToRemove.size());
    while (fieldIndexIterator.hasPrevious()) {
        newFieldMetadata.remove(fieldIndexIterator.previous());
    }

    this.setFieldMetadata(newFieldMetadata);
}

From source file:info.magnolia.cms.util.ExtendingContentWrapper.java

@Override
public Collection<Content> getChildren(ContentFilter filter, String namePattern,
        Comparator<Content> orderCriteria) {
    Collection<Content> directChildren = ((AbstractContent) getWrappedContent()).getChildren(filter,
            namePattern, orderCriteria);
    if (extending) {
        Collection<Content> inheritedChildren = ((AbstractContent) extendedContent).getChildren(filter,
                namePattern, orderCriteria);
        // keep order, add new elements at the end of the collection
        LinkedHashMap<String, Content> merged = new LinkedHashMap<String, Content>();
        for (Content content : inheritedChildren) {
            merged.put(content.getName(), content);
        }/*from ww  w .java 2s.  c  o  m*/
        for (Content content : directChildren) {
            merged.put(content.getName(), content);
        }
        return wrapContentNodes(merged.values());
    }
    return wrapContentNodes(directChildren);
}

From source file:org.eclipse.recommenders.utils.rcp.JdtUtils.java

public static Collection<IMember> findAllRelevanFieldsAndMethods(final IType type,
        final Predicate<IField> fieldFilter, final Predicate<IMethod> methodFilter) {
    final LinkedHashMap<String, IMember> tmp = new LinkedHashMap<String, IMember>();
    for (final IType cur : findAllSupertypesIncludeingArgument(type)) {

        try {/*from w w  w.ja v a  2s  .  co m*/
            for (final IMethod method : cur.getMethods()) {
                if (methodFilter.apply(method)) {
                    continue;
                }
                final String key = createMethodKey(method);
                if (!tmp.containsKey(key)) {
                    tmp.put(key, method);
                }
            }
            for (final IField field : cur.getFields()) {
                if (fieldFilter.apply(field)) {
                    continue;
                }
                final String key = createFieldKey(field);
                if (!tmp.containsKey(key)) {
                    tmp.put(key, field);
                }
            }
        } catch (final Exception e) {
            log(e);
        }
    }

    return tmp.values();

}

From source file:com.cloudmine.api.db.RequestDBOpenHelper.java

/**
 * Get all of the requests that are currently unsynced. Sets their status to in progress
 * @return//from   w  ww .j a va 2 s .  com
 */
public LinkedHashMap<Integer, RequestDBObject> retrieveRequestsForSending(Context context) {
    Cursor requestCursor = loadRequestTableContentsForUpdating();
    LinkedHashMap<Integer, RequestDBObject> requestMapping = createRequestMapping(requestCursor);

    Map<String, RequestDBObject> objectIdsToRequests = new HashMap<String, RequestDBObject>();
    Map<String, RequestDBObject> fileIdsToRequests = new HashMap<String, RequestDBObject>();
    for (RequestDBObject request : requestMapping.values()) {
        String objectId = request.getObjectId();
        if (Strings.isNotEmpty(objectId)) {
            objectIdsToRequests.put(objectId, request);
        }

        String fileId = request.getFileId();
        if (Strings.isNotEmpty(fileId)) {
            fileIdsToRequests.put(fileId, request);
        }
    }
    if (!objectIdsToRequests.isEmpty()) {
        Map<String, String> objectIdToJson = CMObjectDBOpenHelper.getCMObjectDBHelper(context)
                .loadObjectJsonById(objectIdsToRequests.keySet());
        for (Map.Entry<String, String> objectIdAndJsonEntry : objectIdToJson.entrySet()) {
            objectIdsToRequests.get(objectIdAndJsonEntry.getKey()).setJsonBody(objectIdAndJsonEntry.getValue());
        }
    }
    if (!fileIdsToRequests.isEmpty()) {
        Map<String, BaseCacheableCMFile> fileIdToFiles = BaseCacheableCMFile.loadLocalFiles(context,
                fileIdsToRequests.keySet());
        for (Map.Entry<String, RequestDBObject> fileIdAndRequest : fileIdsToRequests.entrySet()) {
            BaseCacheableCMFile cacheableCMFile = fileIdToFiles.get(fileIdAndRequest.getKey());
            if (cacheableCMFile != null)
                fileIdAndRequest.getValue().setBody(cacheableCMFile.getFileContents());
            else
                Log.e("CloudMine", "Had a null file " + fileIdAndRequest.getKey());
        }
    }
    return requestMapping;
}