Example usage for java.util LinkedHashMap LinkedHashMap

List of usage examples for java.util LinkedHashMap LinkedHashMap

Introduction

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

Prototype

public LinkedHashMap() 

Source Link

Document

Constructs an empty insertion-ordered LinkedHashMap instance with the default initial capacity (16) and load factor (0.75).

Usage

From source file:gov.nih.nci.cabig.caaers.web.tags.csm.AuthorizationDecisionCache.java

public AuthorizationDecisionCache() {
    //Initalize the LRU cache.
    decisionCache = new LinkedHashMap<String, HashMap<Object, AuthorizationDecisionCacheEntry>>() {
        @Override/*from   w  ww.  ja v  a2 s.  c  om*/
        protected boolean removeEldestEntry(
                Map.Entry<String, HashMap<Object, AuthorizationDecisionCacheEntry>> eldest) {
            return size() > maxElementsToCache;
        }
    };
}

From source file:ch.cyberduck.core.AbstractCache.java

public AbstractCache(int size) {
    if (size == Integer.MAX_VALUE) {
        // Unlimited
        impl = Collections.synchronizedMap(new LinkedHashMap<T, AttributedList<T>>());
        reverse = Collections.synchronizedMap(new LinkedHashMap<CacheReference, T>());
    } else if (size == 0) {
        impl = Collections.emptyMap();
        reverse = Collections.emptyMap();
    } else {//from   w w  w.ja  va  2s  .c o m
        // Will inflate to the given size
        impl = Collections.synchronizedMap(new LRUMap<T, AttributedList<T>>(size));
        reverse = Collections.synchronizedMap(new LinkedHashMap<CacheReference, T>());
    }
}

From source file:com.teamsun.framework.util.ConvertUtil.java

/**
 * List?Map/*from   w  w w  . j  ava2  s .  com*/
 * 
 * @param list
 * @return Map java.util
 */
public static Map convertListToMap(List list) {
    Map map = new LinkedHashMap();

    for (Iterator it = list.iterator(); it.hasNext();) {
        LabelValue option = (LabelValue) it.next();
        map.put(option.getLabel(), option.getValue());
    }

    return map;
}

From source file:au.id.hazelwood.xmltvguidebuilder.model.ChannelListings.java

public ChannelListings() {
    channelById = new LinkedHashMap<>();
    programsByChannelId = LazyMap.decorate(new HashMap<>(), new ProgrammeDetailSortedSetFactory());
}

From source file:com.adobe.acs.commons.contentfinder.querybuilder.impl.ContentFinderHitBuilder.java

/**
 * Builds the result object that will representing a CF view record for the provided hit.
 * <p>// w  w w.  j a v  a  2 s  .com
 * This method will generate the result object data points based on if the hit is:
 * 1) a Page
 * 2) an Asset
 * 3) Other
 *
 * @param hit a hit
 * @return a result object
 * @throws RepositoryException if something goes wrong
 */
public static Map<String, Object> buildGenericResult(final Hit hit) throws RepositoryException {
    Map<String, Object> map = new LinkedHashMap<String, Object>();

    final Resource resource = hit.getResource();

    /**
     * Apply custom properties based on the "type"
     */

    // Assets
    final Asset asset = DamUtil.resolveToAsset(resource);
    if (asset != null) {
        return addAssetData(asset, hit, map);
    }

    // Pages
    final Page page = getPage(resource);
    if (page != null) {
        return addPageData(page, hit, map);
    }

    // Other
    return addOtherData(hit, map);
}

From source file:io.seldon.prediction.VariationPredictionStrategy.java

public static VariationPredictionStrategy build(List<Variation> variations) {
    Map<Range, SimplePredictionStrategy> strategyMap = new LinkedHashMap<>();
    BigDecimal ratioTotal = BigDecimal.ZERO;
    for (Variation var : variations) {
        ratioTotal = ratioTotal.add(var.ratio);
    }/*from w w  w . j  a  v  a2  s . c  o  m*/
    BigDecimal currentMax = BigDecimal.ZERO;
    for (Variation var : variations) {
        NumberRange range = new NumberRange(currentMax,
                currentMax.add(var.ratio.divide(ratioTotal, 5, BigDecimal.ROUND_UP)));
        strategyMap.put(range, var.variationStrategy);
        currentMax = currentMax.add(var.ratio);
    }
    return new VariationPredictionStrategy(strategyMap);
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions.java

@Override
public Map<String, String> getOptions(EditConfigurationVTwo editConfig, String fieldName,
        WebappDaoFactory wDaoFact) throws Exception {
    // now create an empty HashMap to populate and return
    HashMap<String, String> optionsMap = new LinkedHashMap<String, String>();

    // for debugging, keep a count of the number of options populated
    int optionsCount = 0;

    if (vclassUri == null || vclassUri.equals("")) {
        throw new Exception("no vclassUri found for field \"" + fieldName
                + "\" in SelectListGenerator.getOptions() when OptionsType CHILD_VCLASSES specified");
    } else {/*from w w  w  .  j  ava2  s. c  o  m*/

        // first test to see whether there's a default "leave blank" value specified with the literal options            
        if (defaultOptionLabel != null) {
            optionsMap.put(LEFT_BLANK, defaultOptionLabel);
        }

        // now populate the options                            
        VClassDao vclassDao = wDaoFact.getVClassDao();
        List<String> subClassList = vclassDao.getAllSubClassURIs(vclassUri);

        if (subClassList == null || subClassList.size() == 0) {
            log.debug("No subclasses of " + vclassUri
                    + " found in the model so only default value from field's literalOptions will be used");
        } else {
            for (String subClassUri : subClassList) {
                VClass subClass = vclassDao.getVClassByURI(subClassUri);
                if (subClass != null && !OWL.Nothing.getURI().equals(subClassUri)) {
                    optionsMap.put(subClassUri, subClass.getName().trim());
                    ++optionsCount;
                }
            }
        }
    }

    log.debug("added " + optionsCount + " options for field \"" + fieldName + "\"");
    return optionsMap;
}

From source file:com.mirth.connect.plugins.datatypes.delimited.DelimitedDeserializationProperties.java

@Override
public Map<String, DataTypePropertyDescriptor> getPropertyDescriptors() {
    Map<String, DataTypePropertyDescriptor> properties = new LinkedHashMap<String, DataTypePropertyDescriptor>();

    properties.put("columnDelimiter", new DataTypePropertyDescriptor(columnDelimiter, "Column Delimiter",
            "If column values are delimited, enter the characters that separate columns.  For example, this is a comma in a CSV file.",
            PropertyEditorType.STRING));
    properties.put("recordDelimiter", new DataTypePropertyDescriptor(recordDelimiter, "Record Delimiter",
            "Enter the characters that separate each record (a message may contain multiple records).  For example, this is a newline (\\n) in a CSV file.",
            PropertyEditorType.STRING));
    properties.put("columnWidths", new DataTypePropertyDescriptor(toCommaSeparatedString(columnWidths),
            "Column Widths",
            "If the column values are fixed width, enter a comma separated list of fixed column widths.  By default, column values are assumed to be delimited.",
            PropertyEditorType.STRING));
    properties.put("quoteToken", new DataTypePropertyDescriptor(quoteToken, "Quote Token",
            "Enter the quote characters that are used to bracket delimit column values containing embedded special characters like column delimiters, record delimiters, quote characters and/or message delimiters.    For example, this is a double quote (\") in a CSV file.",
            PropertyEditorType.STRING));
    properties.put("escapeWithDoubleQuote", new DataTypePropertyDescriptor(escapeWithDoubleQuote,
            "Double Quote Escaping",
            "By default, two consecutive quote tokens within a quoted value are treated as an embedded quote token.  Uncheck to enable escaped quote token processing (and specify the Escape Tokens).",
            PropertyEditorType.BOOLEAN));
    properties.put("quoteEscapeToken", new DataTypePropertyDescriptor(quoteEscapeToken, "Escape Token",
            "Enter the characters used to escape embedded quote tokens.  By default, this is a back slash.  This option has no effect unless Double Quote Escaping is unchecked.",
            PropertyEditorType.STRING));

    return properties;
}

From source file:edu.northwestern.bioinformatics.studycalendar.security.authorization.PscUser.java

public PscUser(User user, Map<SuiteRole, SuiteRoleMembership> memberships) {
    this.user = user;
    this.memberships = memberships;

    this.stale = false;
    this.attributes = new LinkedHashMap<String, Object>();
}