Example usage for java.util TreeMap TreeMap

List of usage examples for java.util TreeMap TreeMap

Introduction

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

Prototype

public TreeMap() 

Source Link

Document

Constructs a new, empty tree map, using the natural ordering of its keys.

Usage

From source file:com.jaeksoft.searchlib.renderer.filter.RendererFilterQueries.java

public RendererFilterQueries() {
    filterTerms = new TreeMap<String, Set<String>>();
    filterQueries = new TreeMap<String, String>();
}

From source file:com.zergiu.tvman.controllers.FSBrowseController.java

@RequestMapping(value = "/children", method = RequestMethod.POST)
public @ResponseBody Map<String, String> getChildren(
        @RequestParam(value = "parentPath", required = false) String parentPath) {
    Map<String, String> children = new TreeMap<String, String>();

    if (parentPath == null || "".equals(parentPath)) {
        addRootPaths(children);/*from  w w w  . j a va 2s.co  m*/
    } else {
        try {
            Path parent = FileSystems.getDefault().getPath(parentPath);
            addParentFolder(children, parent);
            addChildFolders(children, parent);
        } catch (IOException e) {
            e.printStackTrace();
            log.error(e.getMessage(), e);
        }
    }
    log.debug("got files " + children);
    return children;
}

From source file:jenkins.model.queue.CompositeCauseOfBlockage.java

public CompositeCauseOfBlockage(List<CauseOfBlockage> delegates) {
    uniqueReasons = new TreeMap<>();
    for (CauseOfBlockage delegate : delegates) {
        uniqueReasons.put(delegate.getShortDescription(), delegate);
    }/*w w w . ja  v  a2s .c o  m*/
}

From source file:ilarkesto.form.DropdownFormField.java

public DropdownFormField<E> setSelectableItems(Collection<E> items) {
    List<E> itemList = (List<E>) (items instanceof List ? items : new ArrayList<E>(items));
    if (!itemList.isEmpty() && itemList.get(0) instanceof Comparable)
        Collections.sort((List) itemList);
    this.selectableItems = new TreeMap<String, E>();
    int i = 0;// w  ww .jav a 2  s  .c om
    for (E item : itemList) {
        String key = Str.fillUpLeft(String.valueOf(i++), "0", 4);
        selectableItems.put(key, item);
    }
    return this;
}

From source file:com.ethlo.geodata.importer.HierarchyImporter.java

@Override
public long processFile(Consumer<Map<String, String>> sink) throws IOException {
    long count = 0;
    try (final BufferedReader reader = IoUtils.getBufferedReader(hierarchyFile)) {
        String line;//  w ww  . j ava2s  .c  o  m
        while ((line = reader.readLine()) != null) {
            if (StringUtils.hasLength(line)) {
                final String[] entry = StringUtils.delimitedListToStringArray(line, "\t");
                final Map<String, String> paramMap = new TreeMap<>();
                paramMap.put("parent_id", stripToNull(entry[0]));
                paramMap.put("child_id", stripToNull(entry[1]));
                paramMap.put("feature_code", stripToNull(entry[2]));
                sink.accept(paramMap);
            }
            count++;
        }
    }
    return count;
}

From source file:com.artemisa.service.MarcaServiceImpl.java

@Override
public Marca update(com.artemisa.domain.Marca entity) throws EntityExistsException, HibernateException {

    Map<String, String> conditions = new TreeMap<>();
    conditions.put("", "nombre = '" + entity.getNombre() + "'");
    conditions.put("and", "id != " + entity.getId());

    List<com.artemisa.domain.Marca> foundMarcas = this.service.find(conditions);

    if (foundMarcas == null) {
        Marca m = this.service.update(entity);
        return m;
    } else {/*from  ww w  .ja  v a 2  s  .  c o m*/
        throw new com.artemisa.service.exceptions.EntityExistsException(
                "La marca con el nombre " + entity.getNombre() + " ya existe!");
    }
}

From source file:pdl.web.service.common.FileService.java

public Map<String, String> uploadFile(MultipartFile theFile, String type, String username) {
    Map<String, String> rtnJson = new TreeMap<String, String>();
    try {/* w  w w  .  j  av  a2 s  .  co  m*/
        /*if(type.isEmpty())
        type="blob";*/

        String fileUid = null;
        if (theFile.getSize() > 0) {
            InputStream fileIn = theFile.getInputStream();
            fileUid = fileTool.createFile(type, fileIn, theFile.getOriginalFilename(), username);
        }

        if (fileUid == null)
            throw new Exception();

        rtnJson.put("id", fileUid);
    } catch (Exception ex) {
        rtnJson.put("error", "File upload failed for " + theFile.getOriginalFilename());
        rtnJson.put("message", ex.toString());
    }

    return rtnJson;
}

From source file:com.recomdata.export.HeatMapRow.java

public HeatMapRow(String gene, Set<String> columns) {
    // values = new LinkedHashMap<String, HeatMapValue>();
    values = new TreeMap<String, HeatMapValue>();
    for (Iterator<String> i = columns.iterator(); i.hasNext();) {
        String columnName = i.next();
        if (columnName.equals("Gene")) {
            values.put(columnName, new HeatMapValue(gene));
        } else {//from ww  w .ja v a2 s.co  m
            values.put(columnName, new HeatMapValue(""));
        }
    }
}

From source file:in.huohua.peterson.network.HttpRequest.java

public HttpRequest(final String url, final String httpMethod, final SortedMap<String, String> params) {
    this.httpMethod = httpMethod;
    this.url = url;
    this.params = params;
    this.headers = new TreeMap<String, String>();
}

From source file:com.jaeksoft.searchlib.renderer.RendererManager.java

public RendererManager(Config config, File directory) throws SearchLibException, XPathExpressionException,
        ParserConfigurationException, SAXException, IOException {
    array = null;/*from   ww w. ja v  a  2  s  .  c om*/
    map = new TreeMap<String, Renderer>();
    for (File f : directory.listFiles()) {
        if (f.isFile()) {
            String fname = f.getName();
            if (!FilenameUtils.isExtension(fname, "xml"))
                continue;
            if (fname.endsWith("_old.xml"))
                continue;
            if (fname.endsWith("_tmp.xml"))
                continue;
            if (f.exists())
                add(new Renderer(new XPathParser(f)));
            else
                add(new Renderer());
        }
    }
}