Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7635019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:20:05+00:00 2026-05-31T07:20:05+00:00

I am facing an issue with hashtable. I am working with blackberry. In the

  • 0

I am facing an issue with hashtable. I am working with blackberry. In the below code the sysout “vector size info is” shows the data has two but the sysout “size in hashtable” shows the data has one. I do not understand this.

try {
  Hashtable listUserEvents = getUserInfo();
  Vector listEvents = new Vector();  
  EventList eventList = (EventList) PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_ONLY);
  Enumeration events = eventList.items();

  while (events.hasMoreElements()) {
    System.out.println("in while");
    Event event = (Event) events.nextElement();

    if (eventList.isSupportedField(Event.START) && event.countValues(Event.START) > 0) {
      long start = event.getDate(Event.START, 0);

      SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
      String dateString = sdf.formatLocal(start);

      SimpleDateFormat sdf1 = new SimpleDateFormat("MMM dd,yyyy");  
      String date = sdf1.formatLocal(start);
      System.out.println("dates are :" +date+ "user" +usrDate);

      if (usrDate.equalsIgnoreCase(date)) {
        System.out.println("dates are equal:" +date);
        EventsBean eventBean = new EventsBean();

          if (eventList.isSupportedField(Event.END) && event.countValues(Event.END) > 0) {
            long end = event.getDate(Event.END, 0);
            SimpleDateFormat sdform = new SimpleDateFormat("MMM dd, yyyy HH:mm");
            String dateString1 = sdform.formatLocal(end);
            eventBean.setStartDate(dateString);
            eventBean.setEndDate(dateString1);
          }
          listEvents.addElement(eventBean);

          if (listUserEvents.containsKey(usrDate)) {
            Vector info = (Vector) listUserEvents.get(usrDate);
            System.out.println("the size in getEvents is" + info.size());
            info.addElement(eventBean);
            System.out.println("vector size info is" + info.size());
            listUserEvents.put(usrDate, info);
          } else { 
            listUserEvents.put(usrDate, listEvents);
          }
        } 
      }
    }

    System.out.println("size in hashtable "+listUserEvents.size());

Now if i loop over this hashtable using the below code i get the data in vector has one

Enumeration events = listEvent.keys();
                         while (events.hasMoreElements()) {
                                     String key = (String) events.nextElement();

                                    if (key.equals(label1.getText())) {

                                         Vector object = (Vector) listEvent.get(key);
                                         System.out.println("vector size"+object.size());
                                          Enumeration hashtable = listEvent.keys();
                                          while (hashtable.hasMoreElements()) {
                                                String keys = (String) hashtable.nextElement();
                                                if (keys.equals(label1.getText())) {

                                                Vector data = (Vector) listEvent.get(keys);

the data here gives only one ,but above it shows two.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:20:07+00:00Added an answer on May 31, 2026 at 7:20 am

    The size of your hashtable is one, because it only has one entry.

    The size of your vector that you store in the hashtable will not be reflected in the size of the hashtable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing strange issue with our WCF service. The same code was working
I have been facing issue with sphinx result set for string attribute. Below is
I got below JSON string, i facing issue parsing because it contains non english
I am facing an issue regarding EF code first version while mapping one entity
I am facing an issue with this simple jQuery code. I have attached the
I'm facing a issue with opening mail client using openURL. Here is the code.
I am facing an issue in getting the correct frame for two different strings.
I am facing an issue in jqgrid's treegrid. For local data the tool barserch
I am facing one issue regarding Layout of detail view in UISplitviewController. below is
I am facing issue while loaidng the data in JQGrid at a later stage

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.