All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebean.codegen.QuestionOptions Maven / Gradle / Ivy

There is a newer version: 4.2
Show newest version
package io.ebean.codegen;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class QuestionOptions {

  private Map opts = new LinkedHashMap<>();

  private int keyStart;

  public void add(String key, String text) {
    opts.put(key.toUpperCase(), text);

    try {
      keyStart = Math.max(keyStart, Integer.parseInt(key));
    } catch (NumberFormatException e) {
      // ignore
    }
  }

  public void addAll(List list) {
    for (int i = keyStart; i < list.size(); i++) {
      add(""+(i + 1), list.get(i));
    }
  }

  public String selected(String key) {
    return opts.get(key.toUpperCase());
  }

  public Set> entries() {
    return opts.entrySet();
  }

  public Set keys() {
    return opts.keySet();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy