Example usage for java.util HashMap values

List of usage examples for java.util HashMap values

Introduction

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

Prototype

public Collection<V> values() 

Source Link

Document

Returns a Collection view of the values contained in this map.

Usage

From source file:fr.aliasource.webmail.common.conversation.ListConversationsCommand.java

private List<RawMessage> rawMessages(ConversationReference cr, HashSet<Long> unseen, HashSet<Long> starred,
        HashSet<Long> answered, IStoreConnection store, Map<Long, IMAPHeaders> fetchedHeaders)
        throws IOException, StoreException {
    ArrayList<RawMessage> ra = new ArrayList<RawMessage>(cr.getMessageIds().size());
    Collection<Long> uids = cr.getUidSequence();
    HashMap<Long, IMAPHeaders> h = HeadersHelper.headers(store, uids,
            (isShowRecipientsFolder ? HEADS_SENT_NO_ENV : HEADS_NO_ENV));
    HashSet<Long> withAttachments = new HashSet<Long>();
    HashSet<Long> withInvitations = new HashSet<Long>();
    Collection<MimeTree> mts = store.uidFetchBodystructure(uids);
    for (MimeTree mt : mts) {
        if (hasAttachments(mt)) {
            withAttachments.add(mt.getUid());
        }//from w ww  .  java  2  s .com
        if (hasInvitation(mt)) {
            withInvitations.add(mt.getUid());
        }
    }

    for (IMAPHeaders hi : h.values()) {
        ra.add(parseHeaders(unseen, withAttachments, starred, answered, hi, hi.getUid(), withInvitations));
    }

    return ra;
}

From source file:edu.utah.bmi.ibiomes.topo.bio.Biomolecule.java

/**
 * Get list of different residues present in the molecule.
 * @return List of residue occurrences//w  w  w . jav  a2  s  . com
 */
public List<ResidueOccurrence> getResidueOccurences() {
    HashMap<String, ResidueOccurrence> occurences = new HashMap<String, ResidueOccurrence>();
    List<ResidueOccurrence> occurrenceList = new ArrayList<ResidueOccurrence>();
    if (this.residues != null) {
        for (Residue residue : residues) {
            String residueType = residue.getCode();
            if (occurences.containsKey(residueType)) {
                occurences.get(residueType).addOccurrence();
            } else {
                occurences.put(residueType, new ResidueOccurrence(residue, 1));
            }
        }
    }
    for (ResidueOccurrence occurrence : occurences.values()) {
        occurrenceList.add(occurrence);
    }
    return occurrenceList;
}

From source file:de.tudarmstadt.ukp.dkpro.core.io.conll.Conll2003Writer.java

private void convert(JCas aJCas, PrintWriter aOut) {
    Type chunkType = JCasUtil.getType(aJCas, Chunk.class);
    Feature chunkValue = chunkType.getFeatureByBaseName("chunkValue");

    Type neType = JCasUtil.getType(aJCas, NamedEntity.class);
    Feature neValue = neType.getFeatureByBaseName("value");

    for (Sentence sentence : select(aJCas, Sentence.class)) {
        HashMap<Token, Row> ctokens = new LinkedHashMap<Token, Row>();

        // Tokens
        List<Token> tokens = selectCovered(Token.class, sentence);

        // Chunks
        IobEncoder chunkEncoder = new IobEncoder(aJCas.getCas(), chunkType, chunkValue, true);

        // Named Entities
        IobEncoder neEncoder = new IobEncoder(aJCas.getCas(), neType, neValue, true);

        for (Token token : tokens) {
            Row row = new Row();
            row.token = token;//from  www. j a v a  2 s .  com
            row.chunk = chunkEncoder.encode(token);
            row.ne = neEncoder.encode(token);
            ctokens.put(row.token, row);
        }

        // Write sentence in CONLL 2006 format
        for (Row row : ctokens.values()) {
            String pos = UNUSED;
            if (writePos && (row.token.getPos() != null)) {
                POS posAnno = row.token.getPos();
                pos = posAnno.getPosValue();
            }

            String chunk = UNUSED;
            if (writeChunk && (row.chunk != null)) {
                chunk = row.chunk;
            }

            String namedEntity = UNUSED;
            if (writeNamedEntity && (row.ne != null)) {
                namedEntity = row.ne;
            }

            aOut.printf("%s %s %s %s\n", row.token.getCoveredText(), pos, chunk, namedEntity);
        }

        aOut.println();
    }
}

From source file:opendap.aws.glacier.Vault.java

public void purgeDuplicatesOLD() throws IOException {

    VaultInventory inventory = getInventory();

    HashMap<String, Vector<GlacierArchive>> archives = new HashMap<String, Vector<GlacierArchive>>();

    GregorianCalendar gc = new GregorianCalendar();

    Vector<GlacierArchive> tuples;
    for (GlacierArchive gar : inventory.getArchiveList()) {
        String resourceID = gar.getResourceId();
        tuples = archives.get(resourceID);
        if (tuples == null)
            tuples = new Vector<GlacierArchive>();
        tuples.add(gar);//from   w  ww . j  a  v a2  s.c  om
    }

    for (Vector<GlacierArchive> archiveTuple : archives.values()) {
        if (archiveTuple.size() > 1) {
            GlacierArchive newest = archiveTuple.firstElement();
            for (GlacierArchive gar : archiveTuple) {
                if (newest.getCreationDate().getTime() > gar.getCreationDate().getTime()) {
                    deleteArchive(gar.getArchiveId());
                } else {
                    deleteArchive(newest.getArchiveId());
                    newest = gar;
                }
            }
        }
    }

}

From source file:models.Expert.java

public String combineEducationExp(ObjectMapper objectMapper) {
    List<HashMap> list = null;
    StringBuffer str = new StringBuffer();
    try {//  w ww.  j av a2  s.  co m
        list = objectMapper.readValue(this.educationExp, List.class);
        if (CollectionUtils.isNotEmpty(list))
            for (HashMap map : list) {
                Collection<String> dd = map.values();
                for (String strMap : dd) {
                    str.append(strMap).append(" ");
                }
            }
    } catch (Exception e) {
        // e.printStackTrace();
        // TODO renyouchao
        return "";
    }
    return str.toString();
}

From source file:models.Expert.java

public String combinejobExp(ObjectMapper objectMapper) {
    List<HashMap> list = null;
    StringBuffer str = new StringBuffer();
    try {//from   w w w  .ja v  a  2  s.c  om
        list = objectMapper.readValue(this.jobExp, List.class);
        if (CollectionUtils.isNotEmpty(list))
            for (HashMap map : list) {
                Collection<String> dd = map.values();
                for (String strMap : dd) {
                    str.append(strMap).append(" ");
                }
            }
    } catch (Exception e) {
        // e.printStackTrace();
        // TODO renyouchao
        return "";
    }
    return str.toString();
}

From source file:info.debatty.jinu.CaseResult.java

/**
 * Get the JSON representation of time results.
 * @return//from  w w  w .  j  a  va2  s  .c om
 */
public final String getJsonTimeDataset() {

    HashMap<TestInterface, Dataset> datasets = new HashMap<TestInterface, Dataset>();
    for (TestInterval interval : getIntervals()) {

        TestInterface test = interval.getTest();
        Dataset dataset = datasets.get(test);
        if (dataset == null) {
            dataset = new Dataset(test.getClass().getSimpleName());
            datasets.put(test, dataset);
        }
        dataset.add(new XY(interval.getParamValue(), interval.getRuntime().getMean()));
    }

    Gson gson = new Gson();
    return gson.toJson(datasets.values());
}

From source file:info.debatty.jinu.CaseResult.java

/**
 * Get the JSON representation of the results, to use with GraphJS.
 * @param vid//from   w  w w .  j  a v  a  2s .  c  om
 * @return
 */
public final String getJsonDatasets(final long vid) {

    HashMap<TestInterface, Dataset> datasets = new HashMap<TestInterface, Dataset>();
    for (TestInterval interval : getIntervals()) {

        TestInterface test = interval.getTest();
        Dataset dataset = datasets.get(test);
        if (dataset == null) {
            dataset = new Dataset(test.getClass().getSimpleName());
            datasets.put(test, dataset);
        }
        dataset.add(new XY(interval.getParamValue(), interval.getValues()[(int) vid].getMean()));
    }

    Gson gson = new Gson();
    return gson.toJson(datasets.values());
}

From source file:gr.iit.demokritos.cru.cps.ai.ComputationalCreativityMetrics.java

public Double CreativityPoints(String new_phrase, ArrayList<String> phrases)
        throws ClassNotFoundException, InstantiationException, IllegalAccessException {
    double creat = 0.0;
    // InfoSummarization inf = new InfoSummarization(language);
    // if (this.language.equalsIgnoreCase("en")) {
    HashMap<String, Double> dict = new HashMap<String, Double>();
    for (String s : phrases) {
        //get the minclosure of the graph of those terms
        dict.put(s, MinClosure(s, ""));
        // System.out.println(s + " " + dict.get(s));
    }/*from w  ww  .  j  a v  a2s  .com*/
    //get the minclosure of the graph of this term
    Double neo = MinClosure(new_phrase, "");
    //for each time the neo closure is bigger than one of the olds, creat++
    for (Double val : dict.values()) {
        if (neo > val) {
            creat++;
        }
    }
    //laize creat to 10
    creat = creat * 10 / phrases.size();
    //  }
    return creat;
}

From source file:org.droidparts.http.CookieJar.java

private Collection<Cookie> getCookies(URI uri) {
    HashMap<String, Cookie> map = new HashMap<String, Cookie>();
    for (Cookie cookie : getCookies()) {
        boolean suitable = uri.getHost().equals(cookie.getDomain())
                && uri.getPath().startsWith(cookie.getPath());
        if (suitable) {
            boolean put = true;
            if (map.containsKey(cookie.getName())) {
                Cookie otherCookie = map.get(cookie.getName());
                boolean betterMatchingPath = cookie.getPath().length() > otherCookie.getPath().length();
                put = betterMatchingPath;
            }/*from  w  ww  .  j  a  v a2 s .c  o  m*/
            if (put) {
                map.put(cookie.getName(), cookie);
            }
        }
    }
    return map.values();
}