Example usage for com.google.common.collect Maps newLinkedHashMap

List of usage examples for com.google.common.collect Maps newLinkedHashMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newLinkedHashMap.

Prototype

public static <K, V> LinkedHashMap<K, V> newLinkedHashMap() 

Source Link

Document

Creates a mutable, empty, insertion-ordered LinkedHashMap instance.

Usage

From source file:com.github.djabry.platform.vaadin.view.AccountProfileView.java

@PostConstruct
public void initProfileView() {

    AuthenticationService authenticationService = DomainServices.getInstance()
            .findService(AuthenticationService.class);
    User currentUser = authenticationService.getCurrentUser();
    BeanItem item = new BeanItem(currentUser);

    BeanFieldGroup form = new BeanFieldGroup(currentUser.getClass());
    form.setItemDataSource(item);//from w  w w. j  a  v  a2  s  .  com
    //Collection<Object> propertyIds = form.getUnboundPropertyIds();
    //Iterator<Object> iterator = propertyIds.iterator();

    Map<String, Boolean> propertyIds = Maps.newLinkedHashMap();
    propertyIds.put("username", false);
    propertyIds.put("email", true);
    Iterator<Map.Entry<String, Boolean>> iterator = propertyIds.entrySet().iterator();

    while (iterator.hasNext()) {

        Map.Entry<String, Boolean> next = iterator.next();
        Object propertyId = next.getKey();
        Field<?> field = form.buildAndBind(propertyId);
        field.setReadOnly(!next.getValue());
        this.addComponent(field);
        field.setWidth(30, Unit.REM);
        // this.setComponentAlignment(field, Alignment.TOP_LEFT);

    }

}

From source file:cc.recommenders.evaluation.distribution.calc.F1ForInputSeveralProvider.java

@Override
protected Map<String, String> getOptions() {
    Map<String, String> options = Maps.newLinkedHashMap();
    options.put("BMN+DEF", OptionsUtils.bmn().c(false).d(true).p(false).useFloat().ignore(false).min(30).get());
    options.put("PBN0+DEF",
            OptionsUtils.pbn(0).c(false).d(true).p(false).useFloat().ignore(false).min(30).get());
    options.put("PBN25+DEF",
            OptionsUtils.pbn(25).c(false).d(true).p(false).useFloat().ignore(false).min(30).get());
    options.put("PBN40+DEF",
            OptionsUtils.pbn(40).c(false).d(true).p(false).useFloat().ignore(false).min(30).get());
    options.put("PBN60+DEF",
            OptionsUtils.pbn(60).c(false).d(true).p(false).useFloat().ignore(false).min(30).get());
    return options;
}

From source file:brooklyn.entity.group.QuarantineGroupImpl.java

protected Map<Entity, Throwable> waitForTasksOnExpungeMembers(Map<? extends Entity, ? extends Task<?>> tasks) {
    // TODO Could have CompoundException, rather than propagating first
    Map<Entity, Throwable> errors = Maps.newLinkedHashMap();

    for (Map.Entry<? extends Entity, ? extends Task<?>> entry : tasks.entrySet()) {
        Entity member = entry.getKey();
        Task<?> task = entry.getValue();
        try {/*from  w w  w  . ja  v  a  2 s. c om*/
            task.get();
        } catch (InterruptedException e) {
            throw Exceptions.propagate(e);
        } catch (Throwable t) {
            Throwable interesting = Exceptions.getFirstInteresting(t);
            LOG.error("Quarantine group " + this + " failed to stop quarantined entity " + member
                    + " (removing): " + interesting, interesting);
            LOG.debug("Trace for: Quarantine group " + this + " failed to stop quarantined entity " + member
                    + " (removing): " + t, t);
            // previously we unwrapped but now there is no need I think
            errors.put(member, t);
        }
    }
    return errors;
}

From source file:com.google.jstestdriver.idea.server.ui.CapturedBrowsersController.java

@NotNull
private static LinkedHashMap<Browser, BrowserButton> createBrowserLabelByNameMap(
        @NotNull JTextField captureUrlTextField) {
    LinkedHashMap<Browser, BrowserButton> map = Maps.newLinkedHashMap();
    for (Browser browser : Browser.values()) {
        BrowserButton button = new BrowserButton(browser, captureUrlTextField);
        map.put(browser, button);//from  ww w.ja va2 s  .c om
    }
    return map;
}

From source file:org.jclouds.cloudsigma.functions.MapToServerInfo.java

@Override
public ServerInfo apply(Map<String, String> from) {
    if (from.size() == 0)
        return null;
    ServerInfo.Builder builder = new ServerInfo.Builder();
    builder.name(from.get("name"));
    builder.description(from.get("description"));
    builder.persistent(Boolean.parseBoolean(from.get("persistent")));
    if (from.containsKey("use"))
        builder.use(Splitter.on(' ').split(from.get("use")));
    if (from.containsKey("status"))
        builder.status(ServerStatus.fromValue(from.get("status")));
    if (from.containsKey("smp") && !"auto".equals(from.get("smp")))
        builder.smp(Integer.valueOf(from.get("smp")));
    builder.cpu(Integer.parseInt(from.get("cpu")));
    builder.mem(Integer.parseInt(from.get("mem")));
    builder.user(from.get("user"));
    if (from.containsKey("started"))
        builder.started(new Date(Long.valueOf(from.get("started"))));
    builder.uuid(from.get("server"));
    builder.vnc(new VNC(from.get("vnc:ip"), from.get("vnc:password"),
            from.containsKey("vnc:tls") && Boolean.valueOf(from.get("vnc:tls"))));
    if (from.containsKey("boot"))
        builder.bootDeviceIds(Splitter.on(' ').split(from.get("boot")));

    Map<String, String> metadata = Maps.newLinkedHashMap();
    for (Entry<String, String> entry : from.entrySet()) {
        if (entry.getKey().startsWith("user:"))
            metadata.put(entry.getKey().substring(entry.getKey().indexOf(':') + 1), entry.getValue());
    }//w  w w  .  j a v a2 s. c om
    builder.nics(mapToNICs.apply(from));
    builder.devices(mapToDevices.apply(from));
    builder.metrics(mapToMetrics.apply(from));
    return builder.build();
}

From source file:de.flapdoodle.mongoom.mapping.entities.EntityContext.java

public EntityContext(Class<EntityBean> entityClass, Entity entityAnnotation, Views viewsAnnotation,
        Map<String, EntityIndexDef> indexGroupMap) {
    super(entityClass);
    _entityAnnotation = entityAnnotation;
    _viewsAnnotation = viewsAnnotation;/*from   w  w w  .j  av  a 2  s .  c om*/
    _indexGroupMap = indexGroupMap;
    _indexDef = Maps.newLinkedHashMap();
}