Example usage for org.apache.commons.collections.map MultiValueMap size

List of usage examples for org.apache.commons.collections.map MultiValueMap size

Introduction

In this page you can find the example usage for org.apache.commons.collections.map MultiValueMap size.

Prototype

public int size() 

Source Link

Usage

From source file:gda.hrpd.data.ExcelReader.java

/**
 * @param args/*from   w w w .j  a  va  2 s  .  co m*/
 */
public static void main(String[] args) {
    System.out.println("testing Excel file reading....");
    ExcelReader er;
    try {
        er = new ExcelReader();
        MultiValueMap sampleData = er.getMvm();
        for (int i = 0; i < sampleData.size(); i++) {
            Collection<?> list = sampleData.getCollection(i);
            for (Object o : list) {
                System.out.print(o + "\t");
            }
            System.out.println();
        }
        // for (Object o : sampleData.keySet()) {
        // System.out.println(sampleData.size(o));
        // Collection sample = sampleData.getCollection(o);
        // System.out.println(sample.size());
        // for (Iterator it=sample.iterator(); it.hasNext();) {
        // Object element = it.next();
        // System.out.print(element.toString() + "\t");
        // }
        // System.out.println();
        // }
    } catch (InstantiationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

From source file:org.lockss.servlet.SubscriptionManagement.java

/**
 * Populates the tabs with the publication data to be displayed.
 * /*from w w  w  . j a  v a 2s. c om*/
 * @param publications
 *          A List<SerialPublication> with the publications to be used to
 *          populate the tabs.
 * @param divTableMap
 *          A Map<String, Table> with the tabs tables mapped by the first
 *          letter of the tab letter group.
 */
private void populateTabsPublications(List<SerialPublication> publications, Map<String, Table> divTableMap) {
    final String DEBUG_HEADER = "populateTabsPublications(): ";
    if (log.isDebug2()) {
        if (publications != null) {
            log.debug2(DEBUG_HEADER + "publications.size() = " + publications.size());
        } else {
            log.debug2(DEBUG_HEADER + "publications is null");
        }
    }

    Map.Entry<String, TreeSet<SerialPublication>> pubEntry;
    String publisherName;
    TreeSet<SerialPublication> pubSet;

    // Get a map of the publications keyed by their publisher.
    MultiValueMap publicationMap = orderPublicationsByPublisher(publications);
    if (log.isDebug3()) {
        if (publicationMap != null) {
            log.debug3(DEBUG_HEADER + "publicationMap.size() = " + publicationMap.size());
        } else {
            log.debug3(DEBUG_HEADER + "publicationMap is null");
        }
    }

    // Loop through all the publications mapped by their publisher.
    Iterator<Map.Entry<String, TreeSet<SerialPublication>>> pubIterator = (Iterator<Map.Entry<String, TreeSet<SerialPublication>>>) publicationMap
            .entrySet().iterator();

    while (pubIterator.hasNext()) {
        pubEntry = pubIterator.next();

        // Get the publisher name.
        publisherName = pubEntry.getKey();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "publisherName = " + publisherName);

        // Get the set of publications for this publisher.
        pubSet = pubEntry.getValue();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "pubSet.size() = " + pubSet.size());

        // Populate a tab with the publications for this publisher.
        populateTabPublisherPublications(publisherName, pubSet, divTableMap);
    }

    if (log.isDebug2())
        log.debug2(DEBUG_HEADER + "Done.");
}

From source file:org.lockss.servlet.SubscriptionManagement.java

/**
 * Populates the tabs with the subscription data to be displayed.
 * //from www .  ja va2s.  co m
 * @param subscriptions
 *          A List<Subscription> with the subscriptions to be used to populate
 *          the tabs.
 * @param divTableMap
 *          A Map<String, Table> with the tabs tables mapped by the first
 *          letter of the tab letter group.
 */
private void populateTabsSubscriptions(List<Subscription> subscriptions, Map<String, Table> divTableMap) {
    final String DEBUG_HEADER = "populateTabsSubscriptions(): ";
    if (log.isDebug2())
        log.debug2(DEBUG_HEADER + "subscriptions = " + subscriptions);

    Map.Entry<String, TreeSet<Subscription>> subEntry;
    String publisherName;
    TreeSet<Subscription> subSet;

    // Get a map of the subscriptions keyed by their publisher.
    MultiValueMap subscriptionMap = orderSubscriptionsByPublisher(subscriptions);
    if (log.isDebug3()) {
        if (subscriptionMap != null) {
            log.debug3(DEBUG_HEADER + "subscriptionMap.size() = " + subscriptionMap.size());
        } else {
            log.debug3(DEBUG_HEADER + "subscriptionMap is null");
        }
    }

    // Loop through all the subscriptions mapped by their publisher.
    Iterator<Map.Entry<String, TreeSet<Subscription>>> subIterator = (Iterator<Map.Entry<String, TreeSet<Subscription>>>) subscriptionMap
            .entrySet().iterator();

    while (subIterator.hasNext()) {
        subEntry = subIterator.next();

        // Get the publisher name.
        publisherName = subEntry.getKey();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "publisherName = " + publisherName);

        // Get the set of subscriptions for this publisher.
        subSet = subEntry.getValue();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "subSet.size() = " + subSet.size());

        // Populate a tab with the subscriptions for this publisher.
        populateTabPublisherSubscriptions(publisherName, subSet, divTableMap);
    }

    if (log.isDebug2())
        log.debug2(DEBUG_HEADER + "Done.");
}

From source file:org.lockss.subscription.SubscriptionManager.java

/**
 * Provides the subscriptions in the system keyed by their publisher.
 * //from w  ww.j  ava 2 s  .  co m
 * @param subscriptions
 *          A List<Subscription> with the subscriptions in the system.
 * @return a MultivalueMap with the subscriptions in the system keyed by their
 *         publisher.
 */
private MultiValueMap mapSubscriptionsByPublisher(List<Subscription> subscriptions) {
    final String DEBUG_HEADER = "mapSubscriptionsByPublisher(): ";
    if (log.isDebug2()) {
        if (subscriptions != null) {
            log.debug2(DEBUG_HEADER + "subscriptions.size() = " + subscriptions.size());
        } else {
            log.debug2(DEBUG_HEADER + "subscriptions is null");
        }
    }

    MultiValueMap mapByPublisher = new MultiValueMap();

    // Loop through all the subscriptions.
    for (Subscription subscription : subscriptions) {
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "subscription = " + subscription);

        // Get the subscription publication.
        SerialPublication publication = subscription.getPublication();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "publication = " + publication);

        // Get the publication publisher name.
        String publisherName = publication.getPublisherName();
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "publisherName = " + publisherName);

        // Save the publisher subscription.
        mapByPublisher.put(publisherName, subscription);
        if (log.isDebug3())
            log.debug3(DEBUG_HEADER + "Added subscription " + subscription + " for publisher " + publisherName);
    }

    if (log.isDebug2())
        log.debug2(DEBUG_HEADER + "mapByPublisher.size() = " + mapByPublisher.size());
    return mapByPublisher;
}