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:org.meruvian.yama.webapi.config.oauth.UserTokenConverter.java

public Map<String, ?> convertUserAuthentication(Authentication authentication) {
    Map<String, Object> response = new LinkedHashMap<String, Object>();
    response.put(USERNAME, authentication.getName());

    if (authentication.getPrincipal() instanceof DefaultUserDetails) {
        DefaultUserDetails details = (DefaultUserDetails) authentication.getPrincipal();
        response.put(USER_ID, details.getId());
    }//from w  ww.  j a v  a  2 s  .  c  om

    if (authentication.getAuthorities() != null && !authentication.getAuthorities().isEmpty()) {
        response.put(AUTHORITIES, AuthorityUtils.authorityListToSet(authentication.getAuthorities()));
    }

    return response;
}

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

/**
 * Creates a new instance./*from  www  . ja  v a  2 s . com*/
 */
public UndirectedOrderedSparseMultigraph() {
    vertices = new LinkedHashMap<V, Set<E>>();
    edges = new LinkedHashMap<E, Pair<V>>();
}

From source file:org.sentilo.platform.server.request.RequestParameters.java

public RequestParameters(final List<NameValuePair> pairs) {
    parameters = new LinkedHashMap<String, String>();
    final Iterator<NameValuePair> it = pairs.iterator();
    while (it.hasNext()) {
        final NameValuePair pair = it.next();
        parameters.put(pair.getName(), pair.getValue());
    }//from  w w w  . j a va2  s .  c  om
}

From source file:com.qwarz.graph.model.GraphNode.java

@JsonIgnore
@XmlTransient// w  ww. j a  v a 2 s  . com
public boolean addProperty(String name, String value) {
    if (name == null || name.isEmpty() || value == null || value.isEmpty())
        return false;
    name = name.intern();
    if (properties == null)
        properties = new LinkedHashMap<String, String>();
    else if (properties.containsKey(name))
        return false;
    properties.put(name, value);
    return true;
}

From source file:com.espertech.esper.filter.FilterParamIndexBooleanExpr.java

/**
 * Constructs the index for multiple-exact matches.
 *//*  w ww .j ava 2  s.  c  o m*/
public FilterParamIndexBooleanExpr() {
    super(FilterOperator.BOOLEAN_EXPRESSION);

    evaluatorsMap = new LinkedHashMap<ExprNodeAdapterBase, EventEvaluator>();
    constantsMapRWLock = new ReentrantReadWriteLock();
}

From source file:com.msyla.usergreeter.user.web.UserResource.java

@RequestMapping({ "/user", "/me" })
public Map<String, String> user(Principal principal) {
    Map<String, String> map = new LinkedHashMap<>();
    map.put("name", principal.getName());
    return map;/*from w ww .  j  a  va2 s  . c  o  m*/
}

From source file:de.xwic.appkit.webbase.actions.EntityActionsHelper.java

/**
 * @param site/*from w w  w . j  a  va 2 s.c  o m*/
 * @param entityProvider
 * @param view
 * @param entityClass
 * @return
 */
public static Map<String, List<IEntityAction>> getEntityActionsInGroups(Site site,
        IEntityProvider entityProvider, String view, Class<? extends IEntity> entityClass) {
    Map<String, List<IEntityAction>> actionsInGroups = new LinkedHashMap<String, List<IEntityAction>>();

    DAO dao = DAOSystem.findDAOforEntity(entityClass);
    List<IExtension> extensions = ExtensionRegistry.getInstance().getExtensions(EXTENSION_POINT_ACTIONS);

    Collections.sort(extensions, new Comparator<IExtension>() {

        @Override
        public int compare(IExtension e0, IExtension e1) {
            // AI 05-Jun-2013: no longer sort by groups alphabetically - keep only the index sorting and 
            // make sure you define the actions in extensions.xml exactly in the order you want them

            //            String g0 = e0.getAttribute("group");
            //            if (g0 == null) {
            //               g0 = "";
            //            }
            //            
            //            String g1 = e1.getAttribute("group");
            //            if (g1 == null) {
            //               g1 = "";
            //            }
            //            
            //            if (!g0.equals(g1)) {
            //               return g0.compareTo(g1);
            //            }

            String strIndex0 = e0.getAttribute("index");
            int i0 = strIndex0 != null ? Integer.parseInt(strIndex0) : 0;

            String strIndex1 = e1.getAttribute("index");
            int i1 = strIndex1 != null ? Integer.parseInt(strIndex1) : 0;

            return i0 < i1 ? -1 : i0 == i1 ? 0 : 1;
        }
    });

    for (IExtension extension : extensions) {
        String applyToView = extension.getAttribute("applyToView");
        String applyToEntity = extension.getAttribute("applyToEntity");

        boolean applies = (applyToView != null && !applyToView.isEmpty()
                && ("*".equals(applyToView) || applyToView.contains(view)))
                || (applyToEntity != null && !applyToEntity.isEmpty()
                        && ("*".equals(applyToEntity) || applyToEntity.contains(entityClass.getName())));

        if (applies) {
            IEntityAction action = createEntityAction(site, extension.getId(), dao, entityProvider);
            if (action != null) {
                String inDropDown = extension.getAttribute("inDropDown");
                action.setInDropDown(inDropDown != null && "true".equalsIgnoreCase(inDropDown));

                String group = extension.getAttribute("group");
                if (group == null) {
                    group = "";
                }

                List<IEntityAction> actions = null;
                if (actionsInGroups.containsKey(group)) {
                    actions = actionsInGroups.get(group);
                } else {
                    actions = new ArrayList<IEntityAction>();
                    actionsInGroups.put(group, actions);
                }

                actions.add(action);
            }
        }
    }

    return actionsInGroups;
}

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

/**
 * Creates a new instance.// www  .  j  a  v  a  2s .c o m
 */
public OrderedSparseMultigraph() {
    vertices = new LinkedHashMap<V, Pair<Set<E>>>();
    edges = new LinkedHashMap<E, Pair<V>>();
    directedEdges = new LinkedHashSet<E>();
}

From source file:org.apereo.lap.services.input.csv.BaseCSVInputHandler.java

/**
 * Make the set of all known CSV handlers (this is expensive so avoid doing it more than once)
 * @param configuration current system config
 * @param jdbcTemplate temp DB jdbc template
 * @return the map of csv filename -> CSVInputHandler (in the correct order for processing and insertion)
 *//*w  w  w  .j a v  a  2 s  .c o  m*/
public static Map<String, CSVInputHandler> makeCSVHandlers(ConfigurationService configuration,
        JdbcTemplate jdbcTemplate) {
    // build up the handlers
    CSVInputHandler csvih;
    Map<String, CSVInputHandler> handlers = new LinkedHashMap<>(); // maintain order
    csvih = new SamplePersonalCSVInputHandler(configuration, jdbcTemplate);
    handlers.put(csvih.getFileName(), csvih);
    csvih = new SampleCourseCSVInputHandler(configuration, jdbcTemplate);
    handlers.put(csvih.getFileName(), csvih);
    csvih = new SampleEnrollmentCSVInputHandler(configuration, jdbcTemplate);
    handlers.put(csvih.getFileName(), csvih);
    csvih = new SampleGradeCSVInputHandler(configuration, jdbcTemplate);
    handlers.put(csvih.getFileName(), csvih);
    csvih = new SampleActivityCSVInputHandler(configuration, jdbcTemplate);
    handlers.put(csvih.getFileName(), csvih);
    return handlers;
}

From source file:io.cloudslang.lang.compiler.parser.DescriptionBuilder.java

public void beginDescription(int startLineNumber) {
    currentDescription = new LinkedHashMap<>();
    currentDescriptionStartLine = startLineNumber;
}